Remove the toilet. Shut off the flow of water at the rear shut-off valve on the wall. Flush the toilet and disconnect the rear water tube connection using a wrench. Remove the nuts on both floor bolts with the wrench and lift the toilet up. Insert a rag into the hole to close up the sewer pipe.
Remove the wax ring from the floor, if applicable, by scraping it off with a putty knife and discarding it. If you don’t see a wax ring, it may still be on the underside of the toilet.
Look at the perimeter of the hole to locate the cast iron flange lip. Insert the thick end of two wooden shims under the flange on each side. The shims will slip under it easily since the flange is elevated.
Position the tip of a cold chisel on top of the flange on one side. Tap the head of the chisel firmly with a hammer until you see a crack form in the cast iron. Reposition the chisel on the opposite side of the flange and tap it again to crack the other side.
Insert a pry bar under the lip of the flange and over one of the wooden shims, which protects the floor from damage. Push back on the handle of the pry bar to raise one side of the cast iron out of the floor. Grip the raised portion and pull it up with your hands. Pry the other half of the flange out of the floor using the same technique.
Insert the lower portion of a new compression fitting flange into the floor hole over the remaining floor pipe. Press the rubber gasket into the space between the flange and the pipe.
Insert the upper portion of the flange on top of the rubber portion and align the screw holes with the underlying holes on the bottom flange portion. Tap the flange with a hammer to insert it fully.
Insert the screws or bolts with a socket wrench until they are tight. Slide the heads of the two closet bolts into the holes on the flange to secure them.
Press a new wax ring into the center of the hole, pull out the rag and reinstall the toilet.