The microwave has evolved into one of the most popular household appliances in the world, but few people know that it was invented entirely by accident.

In 1945, Percy Spencer, an American self-taught engineer, was working in a lab testing magnetrons, the high-powered vacuum tubes inside radars. One day while working near the magnetrons that produced microwaves, Spencer noticed a peanut butter candy bar in his pocket had begun to melt — shortly after, the microwave oven was born.

Today, Percy Spencer's invention and research into microwave technology is still being used as a jumping off point for further research in radar and magnetron technologies. Different wavelengths of microwaves are being used to keep an eye on weather conditions and even rain structures via satellites, and are able to penetrate clouds, rain, and snow, according to NASA. Other radar technology use microwaves to monitor sea levels to within a few centimeters.

Police are also known to use radar guns to monitor a vehicle's speed, which continually transmit microwaves to measure the waves' reflections to see how fast you're driving.

But none of this would be possible if Spencer hadn't first realized the melting candy bar in his pocket all those years ago.

"My grandfather was watching a microwave testing rig, and he realized that the peanut-cluster bar in his pocket started to melt — it got quite warm," Rod Spencer, inventor and grandson of Percy Spencer, told Business Insider.

"So he put two and two together and he decided to get some popcorn, so he sent the popcorn in and it started popping all over the place," Spencer said. "The next morning, he brought in an egg. One of the engineers who was a little disbelieving in terms of a microwave's ability to cook, just as he was looking over, the egg blew up in his face."

With his newfound knowledge on how to cook food in mere seconds, Spencer and his employer, Raytheon, patented the invention, which they called the "RadaRange." Two years later, Raytheon launched the RadaRange as the first commercial microwave oven, which cost $5,000 at the time ($52,628 in 2015 dollars), weighed 750 pounds, and stood just shy of six feet tall.

A RadaRange installed in 1961 aboard the NS Savannah nuclear-powered cargo ship. Wikimedia Commons/Acroterion

"The early microwave ovens, and we had one, were as large as a refrigerator, would take twenty minutes to warm up before you could cook anything, but they were ten times more powerful than anything you can buy today, so a potato was cooked in thirty seconds," Spencer said.

Unsurprisingly, the RadaRange failed to take off immediately due to its steep price and the public's fear of the new technology.

"The microwave oven eventually became known as Raytheon’s largest commercial failure, and the reason why was that like so many other failures, they saw the cool technology but they didn’t understand the market," Spencer said.

Eventually, the refridgerator-sized appliance was shrunk down to a more manageable, countertop size, and according to the University of Southern California, sales of the microwave oven "surpassed those of gas ranges" by 1975.

By that point, people were calling Spencer's invention the "microwave oven" (eventually to be shortened to simply, "microwave"), and adoption skyrocketed around the world. One in four American households owned a microwave by 1986, and the U.S. Bureau of Labor Statistics reported that over 90% of U.S. households owned the appliance by 1997.

Some less-developed countries such as India — where only 5% of the population own a microwave — have yet to widely adopt the technology, but there's no doubt that the microwave has evolved into the fastest way to heat up a meal for a majority of the world.

In 1999, Percy Spencer was immortalized for his invention of the microwave oven, and was inducted in the National Inventors Hall of Fame, which honors other famous inventors like Thomas Edison and the Wright Brothers.