SmartTechnology solutions for business

HTML CSS and JavaScript Formatter

Format pasted code locally and show parse errors, without running JavaScript or loading resources.

Language
Indent

A light formatter: it puts blocks and statements on their own lines and indents them. Text in quotes, <pre> blocks, and your spacing inside a line stay as written. The code is not run.

Your result

Paste code and the tidy version appears here.

How to use it

  1. Choose the language and indent.
  2. Paste the code or press Try a sample.
  3. Copy the result or download it.

Examples

  • Nested HTML<div><p>Hi</p></div> <div> <p>Hi</p> </div>
  • CSSa{color:red;margin:0} a { color: red; margin: 0 }
  • Short text stays on its line<p>Hello <b>world</b></p> <p>Hello <b>world</b></p>
Tool details and privacy

Paste one-line code and get it laid out: each block and statement on its own line, nested tags indented, and CSS and JavaScript inside HTML tidied too.

Reading minified code, or code copied from a page, is close to impossible without indentation.

Options

  • Indent: 2 spaces, 4 spaces, or a tab.
  • Short text elements stay on one line so the spacing people see does not change.
  • <style> and <script> inside HTML are tidied with the same rules.

Limits

  • A light formatter: it does not change spacing inside a line or rewrite code the way tools such as Prettier do.
  • Quoted text, regular expressions, <pre>, and <textarea> stay as written, and the code is not run.

Privacy

What you type stays in your browser. Nothing is uploaded or saved on the server.

Questions

Can formatting change what the code does?

It should not; only line breaks and indentation change. Review the result before replacing your file.

Is CSS inside HTML tidied?

Yes, and JavaScript inside <script> too.

Is the JavaScript run?

No.

Is anything uploaded?

No.

Related tools

All tools