The short answer
For a fish-only tank, 1 to 2 inches (about 2.5 to 5 cm) is typical. Planted tanks usually need 2 to 3 inches, and rooted plants do better with more depth. Measure at the deepest point, and keep the surface level or sloped gently toward the front.
Why depth matters
Depth gives plant roots room to anchor and feed. It also gives bacteria more surface to colonize. A bed that is too shallow gives roots little hold, and stem plants can pull free.
A bed that is too deep has its own problem. Waste settles into the gravel and gets trapped, and the lower layers can form low-oxygen zones. Deep beds need regular vacuuming of the surface during water changes, and an occasional gentle stir of the top layer to keep waste from building up.
Depth for planted tanks
Hobby guides commonly suggest 2 to 3 inches for undemanding plants and 3 to 4 inches for carpeting plants, stem plants and heavy root feeders. Some keepers add a nutrient-rich base layer, about an inch thick, and cover it with gravel. These figures are rules of thumb rather than fixed requirements, so match the depth to the plants you actually keep.
Java fern and anubias
Java fern and anubias are usually attached to wood or rock rather than buried, so they need less depth. If you are curious about how to plant java fern, the key point is not to bury the rhizome, which is the thick stem where the leaves grow. Tie or glue the plant to a piece of wood or a rock and let its roots find their own hold.
Working out how much gravel to buy
Multiply the tank’s length by its width, then by the depth you want. For a 36 by 18 inch footprint at 2 inches deep, that’s 1,296 cubic inches, or about 5.6 U.S. gallons of gravel. Gravel is sold by weight or by the bag, and coverage figures vary by product, so check the bag’s stated coverage. Buy a little extra so you can top up after the first rinse and settling.
Keep the bed clean
Deep gravel traps food and waste, so vacuum the surface during each water change. Avoid digging the whole bed out at once, since that disturbs the bacteria living in the gravel and can release a cloud of waste into the water. Clean the top layer, and work through the bed slowly over several changes if it needs a deeper clean.