This section is for on-trail or temporary repair of a broken chain. In general, we recommend replacing your damaged chain with a new one as soon as possible. Test the chain for wear described in the Chain Care section. It's also possible that the force that broke your chain has twisted another link, or has splayed the outer side plates near the break. (Only a matter of time until it breaks again, usually at the worst moment...) To install a new chain, see the section on installing a new chain.
Inspect the broken chain. Usually, the link right at the break is warped and should be removed. Plan to "break the chain" where you'll have outer side plates on one end, and an inner side plate link facing it.
If you had to remove a damaged link for the repair, the shorter chain may not allow you to use "extreme" gearing combinations, such as your big chainring plus your biggest cog. (You shouldn't be using this combination anyway.)
It's much easier to to fix the chain with a "retaining clip." This is piece of springy wire that holds the ends of the chain while you work with it.
The clip in the picture is just a piece of a wire clothes hanger, bent to shape. I keep this in my toolbox.
Bend a six-inch piece of hanger wire in the middle, around 90 degrees. Now put a sharp bend on each end so it can wrap around and hold a chain link. This works great to hold to hold the chain in place while you work. (See the photo.)And once you've split the chain, it remains in place, instead of falling around the chainrings or through the rear derailleur.
This makes it easy to put the chain back together.Many of us carry a connecting link. This link joins two inner plates together with less stiffness (you'll still need a chain tool to remove the old outer side plates). You need to have the right size (7-speed and 8-speed rear cogs use the same size chain, but a 9-speed uses a thinner chain). It's dirt cheap, and makes it easy to take the chain apart again.
To remove a quick-link from your chain, squeeze inward on the link -- push the side plates towards each other. Then while holding that inward squeeze, compress the chain lengthwise so the end of the pin slides back into the larger side of the oblong hole. You can then pull the link apart.
Connecting pins are available that have a tapered guide. You insert the guide into the link, then use the chain tool to push the pin into position. Then you break off the guide by bending it with a plier. This gives a solid repair, and may allow you to make a repair without losing length. (Shove the old pin out at the break, then reassemble with the breakaway pin.) If you're buying a set of pins, be sure to order the correct size -- 8-speed (same as 7-speed) vs. 9-speed.
Make plans to get a new chain soon. A repaired chain may have subtle damage that can wear your chainrings. Or it may break again at an inconvenient time.