Old-Style (male-threaded spindle) Crank Replacement

This type of crank attachment is still found on some children's bikes and cheaper (lower-quality) mountain bikes. A threaded bolt sticks out of the bottom bracket. The crank fits onto a square tapered spindle, and a nut threads onto the bolt, pushing the crank firmly onto the spindle.  Other crank types: standard female-threaded tapered spindle, splined spindle, tapered splined spindle.

If there's a plastic protector cap, pry it off.
Pop off the dust cover.
Pop off the dust cover.
Finding a socket to remove the nut.
Finding a socket to remove the nut.
Now remove the retaining nut. This is done with a socket wrench. (Your crank extractor may have come with sockets for this type of crank.)
Remove the nut from the spindle. If the crank attachment is damaged, the crank may just fall off the spindle. In most cases, you'll need a crank extractor tool.

DON'T remove the crank by pounding it or prying with a lever. You'll destroy the bearings in the bottom bracket!

Removing the nut using the extractor kit socket.
Removing the nut using the extractor kit socket.
Threading the extractor outer ring into the threads on the inside of the crank.
Threading the extractor outer ring into the threads on the inside of the crank.
See the treads around the inside of the crank? Thread the big end of the crank extractor into them, as far as it will go.
Now turn the core of the crank extractor in.
Threading the inner core of the extractor into the outer ring.
Threading the inner core of the extractor into the outer ring.
Turning the core to pull the crank off the spindle.
Turning the core to pull the crank off the spindle.
When the core stops turning easily, it has hit the spindle. Now it's time to apply a wrench to the core. (Most crank extractors come with a handle specifically for that purpose.)

Continue turning until the crank has come loose from the spindle.

To remove the chainrings from the crank, unscrew the locking. If you don't have a lockring tool, you can take off the small chainring and remove the ring with a large pipe wrench.

If you pulled the crank to replace chainrings , go to work on that now.

If you pulled the crank to work on the chainrings, do it now.
If you pulled the crank to work on the chainrings, do it now.
Inspect the spindle for damage, and check for side-to-side (left-to-right) motion of the spindle in the bottom bracket. Listen for grinding or rubbing as you turn the spindle. If the bottom bracket is bad, now's a good time to replace it

To remove the chain-side crank, put the chain around the frame at the bottom bracket. Now use your hex wrench and crank extractor exactly as you did on the other side. The crank will come off with chainrings attached.

If you're placing a new crank, put it in the same position on the spindle as the old one. Apply Loctite to the threads of the retaining bolt. Tighten the nut, and (if you have one) replace the protector cap.

You're now ready to thread the pedal into the crankarm.