It's inevitable; sooner or later your toilet will leak. Whether from a bad wax ring, bolts coming loose or a crack in the porcelain, all toilets leak from time to time. Hopefully you will notice before the water does any damage to the wood subfloor underneath. Replacing a wax ring or even the entire toilet is easier than replacing the subfloor under a toilet. Most times the sagging subfloor repair only requires replacing a small area, while the flooring itself will have to be totally replaced because you can't match it. Whatever the case, you must fix rotting wood before the toilet goes completely through the floor.
Remove the Toilet
Turn water off to the toilet by closing the valve on the water line behind it. Disconnect the flex water line to the toilet at the valve. Once it has water supply and can no longer refill, flush and plunge the water out of the toilet. Unscrew nuts from the bolts at the bottom of the toilet with pliers or a wrench. If you can't turn them, cut the bolts just below the nuts with a hacksaw. Lift the toilet off the remaining bolts and place on a tarp, upside down. Remove the flange from the drain. Inspect to see if you can reuse it or if you need a new one.
Cut Away the Rotten Wood
Cut at least a few inches past the rotted wood under the toilet wood floor area with a reciprocating saw, up to the closest joists. Discard all rotted wood and clean the drain well.
Make Your Measurements
Measure the open area and cut a new piece of 3/4 inch plywood to fit. (If your subfloor is not 3/4-inch plywood, use plywood the same size as your current subfloor).
Measure from all sides to the drain and mark to cut. Using a hole saw cut the appropriate size hole in the plywood to fit around the drain.
Repair Floor Under Toilet
Nail the plywood to the floor joists. Make sure to make your nails flush with the wood.
Clean the flange well or use a new one and install over the drain and new wood. You may need to scrape the flange with a small putty knife and use a wire brush to get it clean and free of any corrosion or debris.
Install flooring. If you were able to take up tile, you can reinstall it. If you had vinyl, you will need to put new flooring throughout the bathroom.
Clean bottom of toilet by removing old wax ring and all debris. You can use a small putty knife to scrape it and then clean with steel wool. Set in a new wax ring and push down so it doesn't fall off when you turn the toilet over.
Set new bolts in the flange and apply the holders. Place toilet down over the new bolts and right onto the flange. Do not put the toilet down on the wax ring anywhere else or you will distort the ring. Place the nuts on the bolts and tighten. Do not overtighten these nuts or you will crack the porcelain.
Cut the bolts to 1/2 inch over the nut and install the covers that hide them. Screw the flex water line back onto the water line and turn on the valve. The bolts may need to be tightened again after weight is applied to the toilet a few times.