How to Make a Fake Blue Screen of Death With HTML and JavaScript

Updated · 5 min read · By the Hacker Typer team

A blue screen of death is the simplest prank screen to build, because the real one is only text on a coloured background. This page gives you the full file and explains each part in plain language.

Fake blue screen of death text with a sad face, a percentage and a joke stop code
Ready-made version: our Fake Blue Screen has three styles and a custom stop code.

The complete code

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>:(</title>
  <style>
    body {
      margin: 0; height: 100vh; box-sizing: border-box;
      padding: 8% 12%;
      background: #0b5cad; color: #fff;
      font-family: "Segoe UI", Arial, sans-serif;
      display: flex; flex-direction: column; justify-content: center;
      cursor: none;
    }
    .face { font-size: 130px; line-height: 1; margin-bottom: 20px; }
    .big { font-size: 28px; margin: 0 0 16px; }
    .small { font-size: 16px; margin-top: 24px; }
  </style>
</head>
<body>
  <div class="face">:(</div>
  <p class="big">Your computer ran into a problem and needs to restart.</p>
  <p class="big"><span id="percent">0</span>% complete</p>
  <p class="small">Stop code: COFFEE_NOT_FOUND</p>

  <script>
    const percentText = document.getElementById("percent");
    let percent = 0;

    setInterval(function () {
      if (percent < 100) {
        percent = percent + Math.floor(Math.random() * 4);   // jump 0 to 3
        if (percent > 100) percent = 100;
        percentText.textContent = percent;
      }
    }, 900);

    document.addEventListener("dblclick", function () {
      document.documentElement.requestFullscreen();
    });
  </script>
</body>
</html>

How to use this code

  1. Get the file. Press Download above the code to save it as fake-blue-screen.html. Or press Copy code, paste it into a plain text editor (Notepad on Windows, TextEdit in plain-text mode on a Mac, or a code editor such as VS Code) and save it as fake-blue-screen.html. The name must end in .html, not .txt.
  2. Open it. Double-click the file. It opens in your web browser and starts working straight away.
  3. Change it. Open the same file in the text editor, edit something, save, and refresh the browser page to see the result.

Nothing needs to be installed, and the file works without an internet connection.

Double-click the page to go full screen. Press Esc to leave.

How the code works

Easy changes to try

To changeEdit this
The stop codeThe text after Stop code:
The colourbackground: #0b5cad. Use #000 for a black crash screen
The speedThe 900. Smaller is faster
Restart at 100%Add else { percent = 0; } after the closing brace of the if
Old-style text screenRemove the face and set font-family: "Courier New", monospace

Use it kindly

A crash screen can make someone think they have lost their work. Use it on people who will laugh, reveal it within seconds, and never use it to convince anyone to phone a "support" number. That is how real scams work.

FAQ

Is this a real error screen?

No. It is a web page with white text on a blue background. Nothing on the computer has crashed.

How do I close it?

Press Esc to exit full screen and close the tab.

Can I use it on a phone?

Yes, the file opens in any browser. Text sizes are set for a computer screen, so reduce the font sizes for a phone.

More tools

See all tools

Keep reading