You can't drink, you can't smoke and you can't have sex. But there is one human pleasure that's been with astronauts since the dawn of the space age: chocolate.

Astronauts have to eat a well-balanced diet of carefully chosen foods to maintain their health in space, but they’re also allowed to augment their standard menus with “bonus containers” filled with items of their choosing. Sweets, especially chocolates, are a common favorite. “We get requests for chocolates on pretty much every flight,” says Vickie Kloeris, manager of the Space Food Systems Laboratory at NASA's Johnson Space Center in Houston.

The history of chocolate in space traces back to Russian cosmonaut Yuri Gagarin, who became the first person to orbit the Earth in 1961. In their book The First Soviet Cosmonaut Team: Their Lives and Legacies, Colin Burgess and Rex Hall note that Gagarin’s space food on that historic flight consisted of “pureed meat packed in squeezable tubes like toothpaste, followed by another tube containing chocolate sauce.”

Chocolate was also a staple comfort food during the U.S. Apollo missions in the 1960s and '70s. Astronaut Alfred Worden, who served as command module pilot for Apollo 15, remembers that his companions David Scott and James Irwin carried hot chocolate as one of their drinks. “I did not because I thought it would be too sweet,” Worden says. “I carried freeze dried coffee instead.”

Chocolate was also available in a dehydrated pudding form during the Apollo missions, which the astronauts had to reconstitute using a water probe, and as brownies contained in vacuum-sealed bags.

“We have a couple of the brownies from that time in our collection, and they actually look pretty good,” says Valerie Neal, the space shuttle curator at the Smithsonian National Air and Space Museum. “Some of the other foods tend to change color or become dehydrated, but the brownies still look fudgy.”

The selection of space-ready chocolate items has expanded greatly since those early days, says Jennifer Levasseur, who curates the nearly 500 items of space food at the Air and Space Museum. “In the initial stages, you have chocolate pudding or chocolate drinks, and then you start having chocolate chunks,” she says. “By the time you get to the space shuttles, you start seeing many more foods with chocolate elements in them, such as chocolate-covered cookies, chocolate mints and chocolate candies.”

Here, watch astronaut Don Petit use regular and chocolate-tipped candy corn in space to demonstrate how soap cleans grease:

Today’s astronauts can enjoy many of the same chocolate candies that they would at home. NASA has a policy against endorsing any commercial goods or services, so it does not name any of the chocolate brands that have flown in space. But according to Robert Pearlman, editor of the space history and artifacts website collectSPACE.com, astronauts have eaten Swiss chocolate Toblerone while in orbit, as well as Turtles, Dove Bars, Ghirardelli, Kit Kats, Snickers, Raisinets, Reese’s Peanut Butter Cups, Twix and—appropriately enough—Milky Way Bars.

The most common form of chocolate flown today and throughout the 35-year history of the space shuttle program is M&Ms—or as NASA refers to them, “candy-coated chocolates”. Even now, M&Ms are part of the standard menu for astronauts serving stints aboard the International Space Station (ISS). Small volumes of the colorful candies are prepared in clear, nondescript packaging for each mission.

“M&Ms not only serve as foods for the astronauts, but also as entertainment,” Pearlman says. “Astronauts will often release handfuls of them and then catch them with their mouths as the pieces float around.”

In many ways, M&Ms are the perfect space snack. They are bite-sized and, unlike other candies and foods, aren’t likely to crumble. “M&Ms are singular pieces that you can eat very easily, and you can eat multiples of them at one time. And because you’re not likely to bite one in half, you won’t make a mess,” Levasseur says.

Astronauts have also found M&Ms to be useful for explaining science concepts to students in educational videos. “In one demonstration, an astronaut will blow out a globe of water and then nudge an M&M into it, where it will slowly rotate,” Neal says. “Because the sphere of water is perfectly smooth, you can’t see that it’s rotating in microgravity without something like the M&M turning inside.”

The milk chocolate candies that “melt in your mouth, not in your hand” were also flown aboard SpaceShipOne in 2004, when it claimed the $10-million Ansari X Prize. Pilot Mike Melvill was carrying a pocketful of M&Ms when he flew the spaceplane into low-Earth orbit, and at the peak of his flight, he released the candies.

“I reached into my pocket and I took out some M&Ms, all different colors, and let them go in front of my face,” Melvill later recalled at a post-flight press conference. “And they just spun around like little sparkling things. I was so blown away, I couldn’t even fly the [craft]. I got another handful and threw them out as well.” One of those M&M pieces was later sold at auction for $1,400, and as a result of Melvill’s stunt, Mars Inc. signed on as one of the company’s sponsors. A red M&M cartoon character was even added to the side of both SpaceShipOne and its mother ship, White Knight.

Although every space-themed gift shop on Earth sells "astronaut ice cream," that freeze-dried treat flew only once in space, on the Apollo 7 mission in 1968. The dehydrated product was too crumbly to be practical in zero-G and wasn't a popular taste option. Luckily for astronauts, real ice cream made it to space in 2006, when the shuttle Discovery flew a freezer to the ISS for storing research samples that would later be returned to Earth. Rather than flying the freezer into space empty, NASA officials used the opportunity to fly ice cream cups from Blue Bell, a popular dairy in Texas, where the station crew trained at Johnson Space Center. “It was vanilla, with swirled-chocolate sauce,” Pearlman says.

ISS crewmembers were treated to Blue Bell ice cream once again in 2012, when a batch flew aboard the SpaceX Dragon resupply capsule. “The astronauts pretty much have to eat the ice cream right away so they can empty out the freezer and starting putting samples in,” Levasseur says. “But that’s not usually a problem.”