Toilets usually rock because they are not resting flush against the floor.
Floor sagging under toilet.
Usually the cause of a wobbly toilet is that it is not sitting flush against the floor.
It goes under the flange and transfers the load of the flange and toilet and you out onto more solid surrounding wood.
Turn off the water supply to the toilet at the wall.
If it is only the floor then remove the toilet and the tub.
If the subfloor is spongy under your leaking toilet the toilet may have started to wobble and the problem is quickly going to get worse unless you make a fairly major repair.
Replacing a wax ring or even the entire toilet is easier than replacing the subfloor under a toilet.
Underneath the toilet base is a round toilet flange that connects the toilet to the drain pipe.
Disconnect the water line using your wrench or pliers.
Follow the easy instructions that come with your product being sure to tighten each of the four bolts a little at a time so the rubber gasket goes down evenly around the bend pipe.
But if your floor is severely rotted say more than an inch beyond the flange you re stuck replacing the flooring around the toilet.
Flush it several times to empty if of all water.
And cut the floor out and start replaceing with plywood set a skill saw at a deapth that it wil cut through the old floor but not into the joist.
Then you can start the floor repair and toilet and tub.
The raising of the toilet causes it to rock from side to side.
Just make sure the flange is flush tight with the top of the floor otherwise your toilet will wobble.
Take out the floor bolts at the base of the toilet using a wrench.