Skip to content

Easter egg3 min read

How to Add the Konami Code in Webflow

Learn how to add the legendary Konami code to your Webflow site to trigger a secret easter egg.

In this tutorial, Sandro, co-founder of Gemeos Webflow agency, shows you how to add the legendary Konami Code to your Webflow site to trigger a secret easter egg.

Example

Type the sequence on your keyboard

↑ ↑ ↓ ↓ ← → ← → B A

0 / 10 keys

SequenceKeysResult
Konami Code↑ ↑ ↓ ↓ ← → ← → B ACustom easter egg
Detectionkeydown eventSequence stored step by step
ResetWrong keyStarts over from the beginning

Understanding the Konami Code

The Konami Code (↑↑↓↓←→←→BA) is a cheat code invented by Kazuhisa Hashimoto in 1986 for the game Gradius on NES. It became a gaming cultural reference and is used by many sites as a subtle easter egg. On Webflow, developers especially love it.

The script is self-contained, so you don't need any Webflow element. It creates the toast and animations on its own.

(function() {
  var KONAMI = ['ArrowUp','ArrowUp','ArrowDown','ArrowDown',
    'ArrowLeft','ArrowRight','ArrowLeft','ArrowRight','b','a'];
  var idx = 0;

  document.addEventListener('keydown', function(e) {
    if (e.key === KONAMI[idx]) {
      idx++;
      if (idx === KONAMI.length) {
        idx = 0;
        triggerEasterEgg();
      }
    } else {
      idx = e.key === KONAMI[0] ? 1 : 0;
    }
  });

  function triggerEasterEgg() {
    // Confetti if canvas-confetti is loaded
    if (typeof confetti === 'function') {
      confetti({ particleCount: 200, spread: 90, origin: { y: 0.5 } });
    }
    // Toast message
    var toast = document.createElement('div');
    toast.textContent = '🎉 Konami Code activated! +30 lives';
    toast.style.cssText = 'position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);' +
      'background:#111;color:#fff;padding:20px 32px;border-radius:16px;font-size:18px;' +
      'font-weight:500;z-index:99999;animation:konamiFade 3s forwards;';
    var style = document.createElement('style');
    style.textContent = '@keyframes konamiFade{0%{opacity:0;transform:translate(-50%,-60%)}' +
      '15%{opacity:1;transform:translate(-50%,-50%)}85%{opacity:1}100%{opacity:0}}';
    document.head.appendChild(style);
    document.body.appendChild(toast);
    setTimeout(function() { toast.remove(); }, 3000);
  }
})();

2. Combine it with canvas-confetti

To add confetti when the code is activated, load canvas-confetti in the head and the script will trigger it automatically:

// In the  of your page :
// <script src="https://cdn.jsdelivr.net/npm/canvas-confetti@1/dist/confetti.browser.min.js"></script>

3. Customize the easter egg

Replace the content of the triggerEasterEgg() function with any action you want: redirect to a secret page, switch the theme, display a GIF, activate a special mode...

Conclusion

The Konami Code is the web's most iconic easter egg. Type ↑↑↓↓←→←→BA to test it on this page. Use cases:

  • Developer portfolios and creative agencies
  • Gaming or pop culture sites
  • Tech hiring pages

Published on May 20, 2026

Sandro DA SILVA

Growth Marketer, Webflow expert, and jack-of-all-trades. Sandro handles commercial operations, ensures projects run smoothly, and addresses marketing-related issues (SEO, Tracking, Copywriting, etc).

You're going to working with us, guaranteed

Ready to launch your business?

get a quote

Let’s f*****G GO !!