Hermit crabs eat a variety of foods, including vegetables, fruit, some meats, unseasoned breads and other foods. They require calcium, protein, carotene, and antioxidants. If a crab doesn't have enough carotene, its color will fade out, so give him brightly-colored vegetables, such as carrots. Hermit crabs basically eat the same things we do since they're omnivores and scavengers. Obviously, with the exception of some sugary snacks we eat.
To give your crab the calcium he needs, buy some cuttlebone (can be found in bird section) and break it up into chunks. For protein, hermit crabs can eat fish food flakes, brine shrimp, unflavored meat, blood worms, and all sorts of foods.
Give them a variety of foods everyday, not only the commercial food (which some people think is bad for them).