This easy recipe for Cod with Gratin Alioli or Garlic Mayonnaise brings together fresh fish, homemade aioli, and a quick gratin finish for a restaurant-quality meal at home.
Cod with Gratin Garlic Mayonnaise is a dish with strong Mediterranean influences, particularly from regions where seafood plays a central role in culinary traditions. This recipe is reminiscent of Brandade de Morue, a French and Spanish salted cod dish, and shares similarities with Provençal cuisine, where aioli—a garlic-infused mayonnaise—is often paired with fish.
In coastal areas of France, particularly in Provence, grilled or baked fish is commonly served with a rich garlic mayonnaise, sometimes broiled to achieve a golden crust. This technique has been embraced in various European cuisines, where gratinated fish dishes are popular for their combination of creamy textures and crispy finishes. Over time, this method has spread beyond France, influencing contemporary seafood recipes worldwide. Today, Cod with Gratin Garlic Mayonnaise is appreciated for its simplicity, bold flavors, and ability to elevate a humble white fish into a luxurious meal.
Gratin garlic mayonnaise cod finds deep roots in the culinary traditions of other countries like Portugal, where the bacalhau stands out as a national treasure. With over a thousand ways to do cod, Portugal has recipes which share similarities with this traditional recipe that develops the strong flavor of garlic, olive oil, and creamy sauce. Among the dishes closely related to it, Bacalhau com Natas is one favorite dish from Portugal that uses salted cod baked with cream, garlic, and onions until creamy in a rich gratin style. Similar dishes are represented by Bacalhau à Zé do Pipo, which consists of fish in a mayonnaise-like sauce baked to a golden brown. Dominant is the trait of garlic-infused mayonnaise in this delicacy, showing how much passion Portugal has for bold flavors and cozy ones, laying the basis of its cuisine in combining simple, everyday ingredients and turning them into rich and fulfilling meals.
Even thought this recipe doesn’t hold much historical renown against other bacalhau preparations, I personally find it one of my ultimate favourites when preparing cod because it is a creamy but also a well-presented dish.
Recipe Note

Cod with Gratin Garlic Mayonnaise
Equipment
- 1 Oven-safe dish
- 1 Blender
Ingredients
- 4 fillets cod desalted
Garlic mayonnaise
- 2 cloves garlic
- 1 egg
- 1/2 tsp salt
- 1/2 tsp lemon juice
Instructions
- Cut the onion into julienne strips and the potatoes into thin slices.
- Place them in the bottom of the baking dish and drizzle a splash of oil. Then, bake for 20 minutes or until the onion and potatoes are done and golden brown.
- Meanwhile, we prepare the garlic mayonnaise or aioli. Blend slowly the garlics, the egg, the salt and the lemon juice using a blender and keeping the mixer at the bottom of the bowl until the mixture begins to thicken.
- Once the onions and potatoes are ready, put the desalted cod on top of them. Then, spread the garlic mayonnaise over the cod fillets.
- Bake it for 15 minutes at 150 degrees. The trick to obtain the crispy gratin touch is to raise the temperature to 180 degrees with heat on top during the last 5 minutes.
Recommendatios When Preparing Garlic Mayonnaise, Aioli or Alioli
Traditional alioli or garlic mayonnaise, especially in Catalan and Valencian cuisine, is made using only garlic, olive oil, and salt, without eggs. The emulsification process relies purely on the natural stabilizing properties of garlic. However, this method can be quite tricky, requiring skill and patience to achieve the perfect creamy consistency without the oil separating.

To make the emulsification process easier and create a smoother, more stable texture, many modern variations incorporate an egg yolk. The yolk contains lecithin, a natural emulsifier that helps bind the oil and liquid together, preventing separation. This makes it much easier to achieve a thick, velvety sauce compared to the traditional method.
While purists may prefer the original egg-free version, the addition of an egg yolk makes alioli more foolproof, creamier, and richer, especially for those unfamiliar with the traditional method. It also results in a milder garlic flavor, as the egg yolk balances out the strong taste of raw garlic.