Hermit crabs by nature are scavengers, so they will eat almost anything you put in front of them. However, not everything they are willing to eat is good for them.
Hermit crabs eat very little. Uneaten food should be removed DAILY to prevent molding or attracting bugs. This keeps their cage clean and keeps them and you healthy.
Usually the best diet for your hermit crabs is the hermit crab food sold at the store you bought them from. This consists mainly of ground up shrimp pellets and other pelleted food. However, as with humans, crabs become bored with a one-food diet. So, the absolute best diet is the pelleted hermit crab food supplemented with some fresh fruits, vegetables, and grains.
Cereal (minus the milk of course), oatmeal, wheat bread, and crackers are all excellent supplements to their diet.
Fresh fruits and vegetables, especially grapes and lettuce, are relished by most crabs. The all time favorite of almost all crabs is grapes, but they will accept lettuce, tomatoes, coconut, apples, and any other fruit that isn't too citrus.
Other favorites are fish, meat, and peanut butter. Remember to always cut anything you give your crabs into small pieces. NEVER add any flavoring or spices to their food. This will seriously harm your crab.
The most important item in your crab's diet is water. Far more important than food, water is required to keep their gills wet and for drinking. I recommend you use a shallow shell as your water dish. This prevents crabs from drowning and also gives them the needed calcium for their exoskeletons.
A small amount of salty foods are also required by your crabs. Salted pretzels, bacon bits, or other salty foods will work. NEVER put salt in their water, this will dry out their gills.