Skip to content

HTML Formatter

Clean up messy or minified HTML in one paste.

  • 100% Free
  • No Sign Up
  • Works in Your Browser

HTML formatter

Beautify and indent HTML

Indent

Quotes

Everything runs in your browser. Nothing is uploaded.

More Developer Tools

View all tools

Every everyday developer tool, right in your browser.

No installs. No uploads. No signup.

Browse all 36 tools
Developer tools
36
Cheat sheets
10
Bytes uploaded
0

How to use the HTML formatter

Three steps, all in your browser.

  1. 1

    Paste your input

    Type or paste your code or data. Press Sample to try an example.

  2. 2

    Pick the style

    Choose indentation or options. The result updates as you type.

  3. 3

    Copy the result

    Copy the output in one click. Nothing is saved or sent anywhere.

HTML Formatter: what to know

The HTML formatter runs Prettier, the open-source formatter used in many editors, in your browser. It indents nested elements, puts block elements on their own lines and wraps long attribute lists, turning minified or hand-mangled markup into something you can read and edit.

HTML is trickier to format than most languages because whitespace between inline elements is visible on the page: a line break between two links renders as a space. Prettier keeps that whitespace exactly as it was, which is why it sometimes breaks lines in unusual places, such as inside a closing tag. That's deliberate: the page renders the same.

Inline <script> and <style> blocks are formatted as JavaScript and CSS too. Template syntax from frameworks and server languages, such as Jinja, PHP or Handlebars, isn't plain HTML and may not format cleanly; format those in an editor with the matching plugin.

Popular uses

  • Reading the HTML of an email template or CMS export
  • Cleaning up markup before pasting it into a project
  • Unminifying a page's source to understand its structure
  • Making HTML snippets tidy for documentation

Tips for the best result

  • Paste a whole document or a fragment; both work.
  • If the output has an odd break like </a\n>, it's protecting whitespace; changing CSS display or removing the space in the source avoids it.
  • Use the HTML minifier for the opposite job, shrinking markup for production.

Read how JustYourDev works and our privacy details. Code, data and files you use here are processed in your browser and are never sent to our server.

Frequently asked questions