Here are the steps to fix a rocking toilet:

1. Turn off the water supply and empty the tank by flushing the toilet.
2. If the toilet tank and bowl are connected by an elbow, remove the elbow.
3. Tighten bolts at the base of the toilet carefully. Tightening them too much can crack the porcelain of the toilet.
4. If it still rocks, proceed with shimming the base. Check for loose bolts and nuts.
5. Insert plastic shims in the gaps.
6. Trim excess shims and apply caulk.