There are two options this step.
How to replace floor around toilet flange.
It goes under the flange and transfers the load of the flange and toilet and you out onto more solid surrounding wood.
Then remove the toilet by disconnecting the hoses and unscrewing the bolts on the floor.
Rest the toilet bowl on its side place it on a towel or cloth to protect the floor and attach the replacement wax ring to the bottom of the bowl this technique helps ensure the ring is in the proper position when placing the toilet over the flange.
To replace a toilet flange lay newspaper down on the floor around the toilet and turn off the water to the toilet before flushing and siphoning all of the water out of the bowl.
If your toilet has been leaking there is a danger the wooden subfloor will be damaged as a result.
If only the area directly below the flange is rotted you can install a two piece steel closet flange support.
Next install a new wax ring.
The process to repair the subfloor is not easy but it needs to be handled promptly to avoid further damage to the wooden floor below which could eventually result in the toilet falling through.