Baby sloths learn what to eat by licking the lips of their mother. All sloths eat the leaves of the cecropia.
Two-toed sloths have a diverse diet of insects, carrion, fruits, leaves and small lizards, ranging over up to 140 hectares. Three-toed sloths, on the other hand, have a limited diet of leaves from only a few trees, and no mammal digests as slowly.
They have made adaptations to arboreal browsing. Leaves, their main food source, provide very little energy or nutrients, and do not digest easily, so sloths have large, slow-acting stomachs with multiple compartments in which symbiotic bacteria break down the tough leaves. As much as two-thirds of a well-fed sloth's body weight consists of the contents of its stomach, and the digestive process can take a month or more to complete.
Three-toed sloths go to the ground to urinate and defecate about once a week, digging a hole and covering it afterwards. They go to the same spot each time and are vulnerable to predation while doing so. This behaviour may be related to maintaining the ecosystem in the sloths' fur. Individual sloths tend to spend the bulk of their time feeding on a single "modal" tree; by burying their excreta near the trunk of that tree, they may help nourish it. Recent research shows that moths, which live in the sloth's fur, lay eggs in the sloth's feces. When they hatch, the larvae feed on the feces, and when mature fly up onto the sloth above.