If there's a plastic protector cap, pry it off. Now remove the retaining bolt. On most mountain bikes, this is a hex-head bolt. (On some bargain-basement bikes, the spindle may end in a threaded bolt, with a nut holding the crank onto the spindle. If that's what you've got, you're on the wrong page. Click here !)

If you loosen the bolt, then the crank falls away to show a ring with teeth, you have a splined crank: click here !

Remove the bolt 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!
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.
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.
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. (Note: the big disk is a "tooth fairy" protecting the large chainring from damage.)Now use your hex wrench and crank extractor exactly as you did on the other side. The crank will come off with chainrings attached.
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 removed the crank to replace chainrings (rather than replacing a damaged crankset), go to work on that now.