Ratchets are used in conjunction with sockets to tighten or loosen nuts and bolts. Ratchets come in four common sizes, 1/4-, 3/8-, 1/2- and 3/4-inch drive. The size refers to the width of the rotating metal square peg at the end of the ratchet that fits into a corresponding square hole in one end of the socket. The square peg on the ratchet has a small, metal ball on one of the side faces of the peg, which fits into a detent in the socket. Sometimes this ball-detent system can become stuck in the out position while a socket is stuck on it, making the socket almost impossible to remove.
Look at your ratchet and determine if it is a quick-release model. If your ratchet has a button on the top of the end where the socket attaches, you have a quick-release ratchet. Depress the button to release the socket and pull it off.
Pull hard on the socket to remove it, if your ratchet is not the quick-release type.
Clamp the socket and wrench in a vice, if your socket is still stuck on -- on either a quick-release or a regular ratchet -- with the socket coming in from the side and the ratchet handle parallel to the floor.
Hold the end of the ratchet handle and hit middle of the ratchet handle with a hammer until the ratchet releases.
To help prevent sockets from getting stuck, lubricate the ball-detent system of the ratchet with some penetrating oil like WD40. Using the accompanying red hose, squirt the oil around the edge of the ball and into the ball's recess. Put a pair of pliers around the ratchet's square peg and use them to squeeze the ball into its recess. With the ball in its hole, squirt in some more lubricating oil. Release and compress the ball-detent system with your pliers several times to break up any corrosion in the system. Store your ratchet in a dry, clean place to minimise the risk of the ball-detent system becoming stuck again. Do not store the ratchet with a socket still on it.