Code & Foam
A refreshing cocktail inspired by the world of programming, featuring a frothy foam top that resembles a well-written code. This drink combines the zesty notes of gin with the sweetness of elderflower liqueur, topped with a light foam for a delightful finish..

Learn how to make the perfect Code & Foam cocktail recipe at home. This refreshing classic cocktail features gin as the base spirit and is served in a coupe glass. Perfect as a pre-dinner aperitif, this versatile drink is perfect year-round. Get the complete ingredient list, step-by-step mixing instructions, and expert tips.
Code & Foam Ingredients
- 🍸Gin(2 oz)
- 🌼Elderflower liqueur(1 oz)
- 🍋Fresh lemon juice(3/4 oz)
- 🥄Simple syrup(1/2 oz)
- 🥚Egg white(1)
- 💧Soda water(to top)
Mixing Instructions for Code & Foam
- 1.In a shaker, combine gin, elderflower liqueur, fresh lemon juice, simple syrup, and egg white.
- 2.Dry shake (without ice) vigorously for about 15 seconds to create a frothy texture.
- 3.Add ice to the shaker and shake again for another 15 seconds to chill the mixture.
- 4.Strain the mixture into a chilled coupe glass.
- 5.Top with a splash of soda water for a refreshing finish.
- 6.Garnish with a lemon twist.
Why These Ingredients For The Perfect Code & Foam?
Gin
Gin serves as the backbone of the "Code & Foam," providing a crisp and refreshing base that complements the other ingredients beautifully. The choice of gin is crucial, as its botanical profile can significantly influence the cocktail's overall flavor. A London Dry gin, such as Tanqueray or Beefeater, is often recommended for its classic juniper-forward character, which adds a nice herbal complexity. Alternatively, a more contemporary gin like Hendrick's, with its cucumber and rose notes, can introduce a softer, floral element. When measuring, ensure you use a jigger for precision, as the balance of flavors is key to achieving the desired taste.
Elderflower Liqueur
Elderflower liqueur, particularly St-Germain, is chosen for its delicate floral sweetness that elevates the cocktail's profile. This ingredient adds a layer of complexity and a hint of fruitiness, which beautifully contrasts the tartness of the lemon juice. St-Germain is widely regarded for its high quality and authentic flavor, making it a go-to choice. If you're looking for alternatives, consider using a homemade elderflower syrup, though it may lack the depth of flavor found in a liqueur. When incorporating elderflower liqueur, a precise measurement is essential, as too much can overpower the drink, while too little may leave it flat.
Fresh Lemon Juice
Fresh lemon juice is a vital component of the "Code & Foam," providing a bright acidity that balances the sweetness of the elderflower liqueur and simple syrup. The freshness of the juice is paramount; bottled lemon juice lacks the vibrant flavor and aromatic oils found in freshly squeezed juice. For optimal results, use a citrus juicer to extract the juice, ensuring you measure out 3/4 oz accurately. If you're in a pinch, you could substitute with a high-quality bottled lemon juice, but be aware that it may not deliver the same level of brightness and freshness.
Egg White
The egg white in the "Code & Foam" is essential for creating a luxurious, frothy texture that enhances the cocktail's mouthfeel and visual appeal. It adds a silky smoothness that rounds out the flavors, making each sip feel indulgent. When using egg whites, it's important to use fresh eggs for safety and quality; pasteurized egg whites are a good alternative if you're concerned about raw eggs. To achieve the best foam, dry shake (shake without ice) the cocktail first to emulsify the egg white, then add ice and shake again to chill. This technique ensures a stable foam that will hold up beautifully when topped with soda water.
Alternative Ingredients
- •Vodka instead of gin
- •Lemonade instead of simple syrup
- •Aquafaba instead of egg white
A Code & Foam is best served with
🍽️ This cocktail pairs beautifully with light appetizers such as shrimp cocktails, bruschetta, or a fresh garden salad. The zesty and floral notes complement the flavors of seafood and fresh vegetables, making it a perfect pre-dinner drink.


