Long answer: Stainless steel is an alloy formed from iron and at least 10% chromium, along with varying quantities of elements, among them nickel, manganese, carbon, and silicon. You've probably noticed the words "18/10" stamped on high-quality stainless steel flatware. This signifies that its composition consists of 18% chromium and 10% nickel, along with other materials.
Stainless steel resists corroding in damp environments—in other words, it won't rust—because the alloy forms an inert surface film of chromium oxide that protects the metal beneath it from attack by the oxygen in water and air. Here's a fascinating fact: This chromium oxide barrier self-heals when scratched or otherwise disturbed. Stainless steel does corrode when exposed to acid or base solutions, however.
With flatware, there's no question that you can toss it into the dishwasher without a second thought. Just rinse it off before putting it in the appliance to avoid prolonged contact with acids from food, in case you don't run the load immediately. If your knife blades end up with rust spots, the problem isn't with the dishwasher—it's because blades are often made from a harder steel that retains a lasting edge but rusts more easily. They would have gotten rust spots from hand washing, too. The key is to dry them immediately. Silverware manufacturers says hard water can cause discoloration. To remediate this, use a stainless steel cleaner, following the instructions carefully.
Pots and Pans
Now, what about stainless steel pots and pans? Here, some disagreement exists.
Some dishwasher manufacturers claim that dishwasher detergents are harsh, corroding stainless steel and tarnishing its polish, or cause spotting and discoloration. Dishwasher detergent manufacturers, of course, reply with, "Pshaw, not true."
Similar disagreement exists on the par of some companies that manufacture stainless steel pots and pans, who declare that their products aren't dishwasher safe. Many people disagree, however. They believe manufacturers say this so to escape criticism if plastic handles crack or wear poorly under exposure to the heat in a dishwasher, or if bolted-on handles come loose due to the jostling that takes place in the appliance. These fearless souls repeatedly run their stainless steel pans in the dishwasher.
Other folks follow the manufacturers' recommendation to hand wash because they want their highly polished cookware to stay that way. They achieve this by carefully drying cookware immediately after washing it in the sink, using gentler detergents. The only stainless steel pots they wash in the dishwasher are those that are clearly labeled "dishwasher safe."