Things You'll Need
To remove the entire toilet or just replace the water fill valve or ballcock, you always need to remove the coupling nut. This nut basically secures the water supply line to the toilet. It's typically located underneath the tank, on the outside, where the water comes in. It's not difficult to remove the coupling nut, but there are steps you must first take before you even touch a wrench to it. Otherwise, you'll have a mess to clean up.
Shut the water off. Locate the water shutoff valve behind the toilet. Turn it clockwise until it won't turn any further. Flush the toilet and hold the handle down to completely empty the tank.
Lift the toilet tank lid up and off carefully; set it aside so it doesn't get chipped or broken. Use a sponge to remove any water remaining in the tank. Wring the sponge out in a bucket when it gets saturated.
Locate the coupling nut on the underside of the toilet tank. Empty the bucket and place it underneath the water supply line. Use a pair of pliers to just loosen the coupling nut. Then finish loosening the nut with your fingers. Gently pull the nut down. The end of the water supply line will come away from the connection. Place it in the bucket to drain the water inside it. You're now ready to proceed with the rest of the steps needed for your replacement task.
The coupling nut may be plastic. Use care when handling plastic plumbing parts. They can easily be stripped, cracked or broken. When you replace the coupling nut, make sure not to over-tighten it.