Online HTML, CSS & JavaScript Editor

index.html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <title>My page</title>
  <style>
    body { font-family: system-ui, sans-serif; text-align: center; padding: 2rem; }
    button { padding: 0.5rem 1rem; font-size: 1rem; cursor: pointer; }
  </style>
</head>
<body>
  <h1>Hello, World!</h1>
  <p id="count">Clicked 0 times</p>
  <button id="btn">Click me</button>

  <script>
    let clicks = 0;
    document.getElementById("btn").addEventListener("click", () => {
      clicks++;
      document.getElementById("count").textContent = "Clicked " + clicks + " times";
    });
  </script>
</body>
</html>
Output

The preview will appear here. Press Run.

About this HTML/CSS/JS compiler

This free online HTML editor lets you write HTML, CSS and JavaScript together in a single file and see the result in a preview pane as soon as you press Run.

It is useful for learning web basics, trying out a layout idea, or testing a snippet from a tutorial. The preview runs in a sandboxed frame, so your page cannot affect this site.

How to use it

  1. Write a complete HTML page in the editor. Put CSS in a style tag and JavaScript in a script tag.
  2. Press Run (or Ctrl + Enter).
  3. Your page appears in the preview pane on the right.
  4. Change the code and press Run again to refresh the preview.

Features

  • HTML, CSS and JavaScript in one file
  • Live preview in a sandboxed frame
  • Dark and light themes for the editor
  • Automatic saving in your browser, download as .html

Good to know

Frequently asked questions

Can I use CSS and JavaScript?

Yes. Put CSS inside a style tag and JavaScript inside a script tag in the same HTML file.

Why does the preview look different from my full website?

The preview is a single file in a sandboxed frame. It has no access to other files, so linked local stylesheets, scripts and images will not load. Use full URLs for outside resources.

Is my code saved?

It is saved in your browser automatically so you do not lose it on refresh. You can also download it as an .html file.

Is it free?

Yes. No sign-up and nothing to install.

Other online compilers