About the HTML Formatter playground

The HTML Formatter takes compact or inconsistently indented markup and rewrites it with clean indentation that reflects the document tree. It places block elements on their own lines, indents nested children, and tidies attribute spacing so the structure of a page becomes immediately clear. Everything happens in your browser, so your markup, including any inline data or template fragments, is never uploaded anywhere.

HTML (HyperText Markup Language) is the structural foundation of every web page, using nested elements and attributes to describe content for browsers. Markup is frequently minified for production or generated by templates, leaving it as one long, unreadable line. Reformatting restores the visual hierarchy so you can quickly find an element, verify nesting, and spot unclosed tags. Well-formatted HTML also makes code review and accessibility audits considerably easier.

HostedHTML Formatter runtime
mainentry file
single fileworkspace
stdinprogram input

How it works

1

Write

The main file is the entry point for each run.

2

Give it input

Use the Input panel to pipe standard input to your program when it needs data.

3

Run

Run sends your code to a fresh hosted runtime and streams the result into the output panel.

4

Keep or share

Your draft stays in this browser, and Share creates a separate snapshot link.

External resources

  • html.spec.whatwg.org— Format reference

Messy input

<ul><li><a href="/home">Home</a></li><li><a href="/about">About</a></li></ul>

Formatted output

<ul>
  <li>
    <a href="/home">Home</a>
  </li>
  <li>
    <a href="/about">About</a>
  </li>
</ul>

Document skeleton

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>Page</title>
  </head>
  <body>
    <h1>Hello</h1>
  </body>
</html>

Form messy input

<form action="/submit" method="post"><label for="email">Email</label><input id="email" type="email" name="email" required><button type="submit">Send</button></form>

Form formatted output

<form action="/submit" method="post">
  <label for="email">Email</label>
  <input id="email" type="email" name="email" required />
  <button type="submit">Send</button>
</form>

Table formatted

<table>
  <thead>
    <tr>
      <th>Name</th>
      <th>Price</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Widget</td>
      <td>$9.99</td>
    </tr>
  </tbody>
</table>

Semantic layout formatted

<header>
  <nav>
    <a href="/">Home</a>
  </nav>
</header>
<main>
  <article>
    <h2>Title</h2>
    <p>Body text.</p>
  </article>
</main>
<footer>
  <p>&copy; 2026</p>
</footer>

Select dropdown messy input

<select name="size"><option value="s">Small</option><option value="m" selected>Medium</option><option value="l">Large</option></select>

Select dropdown formatted output

<select name="size">
  <option value="s">Small</option>
  <option value="m" selected>Medium</option>
  <option value="l">Large</option>
</select>

Figure with media formatted

<figure>
  <img src="chart.png" alt="Sales chart" />
  <figcaption>Quarterly sales</figcaption>
</figure>

How it works

The editor uses Monaco, the engine behind VS Code, with language-aware editing tools and familiar keyboard controls.

What it does

Paste compact markup and it rewrites the HTML with indentation that mirrors the tree.

Block elements are placed on their own lines and nested children are indented.

Attribute spacing is tidied so the page structure is immediately clear.

Formatting behavior

Restores the visual hierarchy of minified or template-generated markup.

Makes it easy to verify nesting and spot unclosed tags.

Helps you quickly locate a specific element in a large document.

Privacy

Everything happens in your browser, so markup is never uploaded anywhere.

Inline data or template fragments stay entirely on your machine.

Tips

Copy the formatted markup to paste back into your project.

Useful for accessibility audits and reviewing structural changes.

Every shortcut, searchable:

Editing

Undo
Ctrl+Z
Redo
Ctrl+⇧+Z
Select next occurrence
Ctrl+D
Delete line
Ctrl+⇧+K
Move line up / down
Alt+↑ / ↓
Copy line up / down
Alt+⇧+↑ / ↓
Toggle comment
Ctrl+/
Indent line
Ctrl+]
Outdent line
Ctrl+[

Navigation

Find
Ctrl+F
Find & replace
Ctrl+H
Go to line
Ctrl+G
Go to symbol
Ctrl+⇧+O

Selection

Select all
Ctrl+A
Select line
Ctrl+L
Select all occurrences
Ctrl+⇧+L
Shortcuts follow your OS — ⌘ becomes Ctrl on Windows and Linux.
It reformats minified or messy HTML into clean, indented markup that mirrors the document tree, making nesting and structure easy to follow.
No. The formatter runs entirely in your browser, so your markup and any embedded content never leave your device.
Yes, it is completely free with no sign-up and no usage limits.
Yes. You can choose the indent size in spaces or use tabs so the output matches your project's style.
It focuses on indentation and spacing. It preserves your markup as written, so it will not silently rewrite or auto-close malformed elements.
Input
Output

Output

Start typing to auto-process

>_compilebytes

A fast place to write code and run it in isolated hosted runtimes. Free, forever.

Playgrounds

Python compilerC compilerJavaScript compilerC++ compilerTypeScript compilerGo compilerJava compilerRust compiler
All playgrounds →

Tools

JSON formatterRegex testerBase64 encoderJWT decoder
JSON formatterBase64 encoder & decoderRegex testerJWT decoder
All tools →

Company

TermsPrivacy[email protected]
© 2026 compilebytes115 runtimes · no signup115 runtimes · isolated sandboxes · no signup