In the annals of breakfast history, the Egg McMuffin is a true early-morning star. It’s a fact most of us have known since a McDonald’s vice president and franchise owner trademarked the egg, ham, and cheese sandwich in the 1970s in order to bring breakfast service to the masses. It’s obvious now that he hit on a winner.

“The Egg McMuffin is the perfect template for a sandwich,” said Corey Cova, sandwich savant, culinary consultant, and former proprietor of Lord Hamm.

The McMuffin’s deliciousness lies in its extraordinary simplicity. It’s barely different from what your short-order deli cook would whip up in two seconds on weekday mornings—proof that it’s no problem to recreate one in the comforts of your own kitchen. At McDonald’s, the muffin-making method is subject to the rhythm of a fast-food production line; and so by making slight tweaks to how we arrange the cheese slice or cook the ham, we can arrive at a breakfast delight that just might even taste better than the real thing.

The trick here is to optimize each element of the four-part sandwich without compromising the essential qualities that make an Egg McMuffin an Egg McMuffin—the interplay of chewy muffin, tender egg, salty ham, and artificial cheese just barely melting on top.

To crack the code, we’ve tapped Cova along with egg-expert J. Kenji Lopéz-Alt, managing culinary director at Serious Eats and author a new book also called The Food Lab—who, coincidentally, has been independently researching breakfast-sandwich techniques. Here is the complete guide to making an Egg McMuffin clone. 

1. English Muffin

The perfect size and texture to hold one egg, one cheese slice, and one ham slice, English muffins are where the McMuffin starts. Thomas’ brand is consistent, as Cova points out, and its famous crannies are perfect for capturing flavor. For Lopéz-Alt, one of the major at-home improvements to make on the classic is to sub in a freshly baked English muffin of a more handmade quality. If you’ve got a source (like Runner & Stone in New York or The Model Bakery in Napa), try making Egg McMuffins on one of those gourmet breads.

2. Toasting

For the right texture, you need to toast the muffin first. You can of course do this in a toaster. If so, butter the muffin afterwards. But the better way to prep—and an improvement on McD’s version—is to split the muffin, then place it facedown in melted butter in your pan or griddle. “Brown it with a little bit of butter,” says Cova. “It keeps its soft structure but can get a nice crunch to it.”

3. Cheese

Slices of American provide the quintessential flavor and texture in an Egg McMuffin, melting from the heat of the other ingredients and adding that signature gooeyness. You don’t have to do much in the way of prep besides buy some American cheese and get ready to unwrap it when the egg, ham, and English muffin are ready for assembly.

4. The Egg

The perfectly round, hard-yolked, tender egg is “the only part that’s remotely different” from any old sandwich, says Lopéz-Alt. “The eggs steam instead of fry. They don’t have that cooked egg flavor that you get in crispy eggs.” During cooking they acquire no color, staying pristinely white.

To achieve that quality, here’s a basic method: Preheat a nonstick pan over medium-low. Spray with cooking spray or brush with olive oil. Take a biscuit cutter that’s about the same size as your English muffin. You can also use a tuna fish can from which both top and bottom have been pried off (clean it very well). Brush or spray the cutter or can with oil and place in the center of the pan. Once it’s there, don’t slide it, said Lopéz-Alt, because this is metal on nonstick coating. Break the egg into a small bowl, then carefully pour it inside the cookie cutter. Pour water up into the pan outside the cutter, to about ½-inch high. Break the yolk with the back of a spoon and sprinkle lightly with salt. Then, cover the pan with a lid and let the egg cook for 4 to 5 minutes, until the yolk is cooked to your preference. “You can peek occasionally, but don’t peek a lot because you want the steam to stay inside,” warns Lopéz-Alt. When the egg is done, lift the cookie cutter out with a potholder, then use an offset spatula or thin butter knife to detach the egg from its mold. If water has seeped in, blot the egg on paper towels.

5. The Ham

You can use that same biscuit cutter or tuna can for shaping your ham slice into a perfectly sized ham round. (Cut the ham before you make the egg for optimal timing.) At McDonald’s, cooks do heat the ham, but probably in the microwave. Do one better by searing the slice off in a skillet, perhaps in the same one used to crisp your muffins, until both sides are dotted with gold. “I always prefer a little bit of a caramelization on it,” says Cova.

6. Assembly

At McDonald’s, the assembly order is as follows: bottom of the muffin, cheese, egg, ham, top of the muffin. Placing the egg between two warm things does help it melt, but Lopez-Alt says the sequence, which optimizes the motions of a fast-food cook, isn’t ideal. “They only reason they do the cheese on the bottom is for efficiency of the production line,” says Lopéz-Alt. “Heat rises, and you want the heat of the egg to melt the cheese. Those corners, I want them to droop over the edges. They’re the mortar of the sandwich. Cheese in between the egg and the ham holds the whole thing together.” Experiment with positioning the cheese above or below the egg to find your grail.

7. Wrapping

Here’s where best home cooking practices and fast-food standards collide. When your purchased Egg McMuffin comes off the grill, it lands in a piece of lined foil, which a cook folds around it. This steams the McMuffin slightly, helping to “soften the English muffin and melt the cheese,” says Lopéz-Alt. When you unwrap the sandwich, you’re treated to its unmistakable aroma, which has developed inside the seal. You don’t absolutely need to add in this step, but if you’re after the platonic ideal, “wrap the sandwich and let it sit for a minute, about the length of time it takes to walk out to the car [from a McDonald’s],” advises Lopéz-Alt.

8. Variations

While there are infinite variations on the egg and cheese, it’s not so simple to decide how far you can stray from the four-ingredient classic and still produce a reasonable McD’s lookalike. “It’s hard to change much about an Egg McMuffin without losing the Egg McMuffiniess of it,” says Lopéz-Alt, though he also reasoned, “I like putting mayo and hot sauce on my sandwiches.” Cova likes to think you can channel the inventiveness of Herb Peterson, the VP who invented the sandwich, and make some tweaks. In that spirit, he has been known to throw a smashed burger instead of ham on the sandwich, or to layer in Mexican ingredients, inspired by the torta. If you can get your hands on a McDonald’s-like hashbrown—or even some frozen tater tots, reheated—he says to try sticking some of those crispy-edged potatoes right into the sandwich for an off-menu treat.