Toilet tanks connect to the toilet using two bolts anchored through the tank and into the back of the toilet. The bolts thread down from the tank with nuts on the back of the toilet. Small leaks and exposure to a moist environment will cause the toilet bolts to rust and corrode over time. You can typically remove the bolts with an adjustable wrench or vice grips. Severely rusted nuts and bolts require special attention to be successfully removed. The removal destroys the bolts, so you will have to replace the hardware.
Remove any decorative plastic caps from the bolts.
Loosen the bolts as far as possible with adjustable pliers. You may be able to loosen the bolts somewhat before the rust locks the bolt up.
Cut the bolt off at the base. A handheld hacksaw allows for controlled cutting, which is necessary if you do not want to damage the toilet. A reciprocating saw with a metal cutting blade makes the job quick and easy but could scratch the base of the tank. Position the saw blade of either tool so that the blade is flat on the surface of the toilet and pressed against the bolt. Cut through the bolt until it breaks free.
The process applies to rusted bolts in the tank or the ground bolts securing the toilet to the floor.