Remove the old mattress and box spring from the bed frame. Place the bed frame on its side so you can easily access all four legs. Inspect the inside of the box frame for bolts securing the legs to the frame. Remove the bolts with a socket and ratchet. If you cannot locate any bolts, cut the legs off flush with the bottom of the box frame with a flat saw.
Place a post on each end of the bed and position the top of the post flush with the top of the bed frame.
Drill two pilot holes through the bed frame and into the post with a drill. Secure the posts to the bed frame with lag bolts and a socket set. Do this with both legs.
Flip the bed over and secure the second set of posts to the bed frame in the same manner as the first posts.
Place a mark on the front left and the rear left leg approximately halfway between the floor and the bottom of the bed frame. Position the marks so they face each other. Do the same with the front right and the rear right legs. Finally, place a mark on both rear legs so the marks face each other.
Drill a 1-inch hole halfway through the legs, using the marks as your locators.
Measure the distance between the front left leg and the rear left leg. Then measure the distance between the front right leg and the rear right leg, then measure the distance between both rear legs. Add 2 inches to each measurement.
Cut 1-inch dowel rods on a miter saw to match each of the three measurements.
Place wood glue into the holes in the legs and insert the down rods into the holes. Tap the rods into place, tapping the legs with a rubber mallet. Allow 24 hours for the glue to dry.
Sand any rough edges with a 600-grit sanding block, then paint or stain the new legs to match the bed frame.