toolqik

174 · HTML & SEO

HTML Formatter

Beautify messy or minified HTML with clean indentation, including inline CSS and JavaScript.

Runs in your browser
Indent
Options
Result

  

About this tool

Paste HTML that is minified, generated or just messy, and get it back with one element per line and consistent indentation. The formatter also re-indents CSS inside <style> and JavaScript inside <script>, so a whole page is readable in one go. Everything runs in your browser; your markup never leaves your device.

How to use it

  1. Paste HTML, drop an .html file onto the box, or click Open file.
  2. Pick the indentation, the line width and how long tags with many attributes should wrap.
  3. Copy the result or download it as index.html.

What it changes, and what it leaves alone

  • Changes: line breaks and indentation between tags, and the layout of inline CSS and JavaScript.
  • Leaves alone: the content of <pre> and <textarea>, where whitespace is visible, and the text inside inline elements such as <a>, <strong> and <span>, so spacing between words doesn’t change.
  • Doesn’t fix errors. Unclosed or misnested tags are formatted as written. Use the HTML Validator to find them.

Attribute wrapping

Tags with many attributes, common in frameworks and component libraries, become long lines. One per line puts each attribute on its own line when a tag has more than one, which makes diffs easier to review. Keep as written leaves attributes where you put them.

Template languages

Handlebars, Jinja, Liquid and PHP tags are kept as text and usually format well. Vue and Svelte single-file components format fine; JSX is JavaScript, so use the JavaScript Formatter instead.

FAQ

How do I beautify minified HTML?

Paste it into the box. The formatted HTML appears as you type, with one element per line and the indentation you choose.

Will formatting change how my page looks?

No. Whitespace inside inline content and inside <pre> and <textarea> is kept, so the rendered page is the same. Only the source layout changes.

Does it format inline CSS and JavaScript?

Yes, by default. Turn off “Format <script> and <style>” to keep them exactly as written.

Can it fix broken HTML?

It formats what you give it but doesn’t repair it. Run the HTML Validator to find unclosed tags, duplicate IDs and other errors.

Is my HTML sent anywhere?

No. Formatting uses js-beautify running in your browser, and nothing is uploaded.

esc
↑↓ navigate↵ open