You can often buy crabs already cooked and cleaned, but I find the best-tasting crab are crabs you've cooked yourself. Chilling crabs after cooking them doesn't ruin the flavor, but it does diminish it a bit. For the sweetest, most tender, most succulent crab, try cooking it at home.
How to Boil Crabs: Boiling is the most common way to cook crabs and a favorite for all varieties. Bring a large pot of water to a boil. Make sure to salt it enough so it tastes as salty as ocean water. Some people swear by adding beer or white wine to the water. Add any seasonings you like - Old Bay has its fans, that's for sure - and then the crabs. Add them as quickly after one another as possible, so they cook for the same amount of time. Bring the water back to a boil and cook until the crabs start to float. Depending on the size of the crabs, this will happen in 10 to 15 minutes or so. Use tongs to remove the crabs and set them out until cool enough to handle.
How to Steam Crabs: I prefer to steam crabs, since it helps them hold onto their own tasty juices and keeps them from becoming water-logged. Bring an inch of salt water to a boil in a large pot. Put the crabs in a steamer basket or insert, or simply pile them into the pot and let the bottom crab or two boil slightly and act as a platform for the other crabs to steam. Cook 10 to 20 minutes, depending on the size of the crabs. Remove the steamer or pull the crabs out of the pot with tongs.
However you cook the crabs, let them sit until cool enough to handle before you clean and serve them. I've been known to give them a rinse under cool water to speed up the process.
Never cleaned crabs before? See How to Clean Crabs.
How to Grill Crabs: You need to clean crabs before you grill them. I find that a quicker boil or steam so they're half-cooked is the way to go. Boil or steam them as outlined above for about 5 minutes, let them cool, then clean them. Then toss the whole cleaned crabs (or halves or quarters depending on the size) with some olive oil and maybe a minced clove of garlic or two, plus some chopped rosemary or thyme leaves if you like, and set them on a hot grill until cooked through and browned, about 4 minutes per side. (Do you happen to have soft-shell crabs? See how to grill them here.)
How to Roast Crabs: As with grilled crabs (above) you need to quickly boil or steam them and clean them first (unless, that is, you're the type of person who can clean a live crab). Then toss them with some oil or melted butter, and aromatics or spices or herbs you like (minced shallot or garlic is yummy, but so is a mix of minced ginger and green onions), set the crabs in a mainly single layer in a roasting pan and cook in a hot oven (450°F or even 500°F) until the crabs are browned and sizzling (and cooked through), about 10 minutes.
Once you have it, see How to Eat Crab like a pro.