HTML Formatter

Make HTML readable again. Paste minified or messy markup and get neatly indented code, including the CSS in style tags and the JavaScript in script tags. Choose the indent and whether to wrap long lines.

Your HTML

Formatted HTML

    How to use the HTML Formatter

    1. Paste your HTML, or use Try an example.
    2. Choose the indent and line wrapping.
    3. Copy the formatted HTML or download it as a file.

    Your data stays on your device. This tool runs entirely in your browser. Nothing you type or paste is sent to our server or saved. Read our privacy policy.

    Make messy HTML readable

    Minified HTML, page source copied from a browser or code exported by a website builder is hard to read. The formatter indents each nested element so you can see the structure at a glance, and it formats CSS inside <style> tags and JavaScript inside <script> tags too.

    Spaces or tabs?

    Two spaces is the most common style for HTML because pages nest deeply. Four spaces or tabs are fine if your team uses them; consistency matters more than the choice.

    Line wrapping

    Turning on wrapping breaks very long lines, such as tags with many attributes, so you don't have to scroll sideways. Leave it off if you plan to compare files line by line.

    Will formatting break my page?

    Formatting changes only whitespace between tags. In rare cases whitespace matters, for example inside <pre> blocks or between inline elements where a space appears between words, and the formatter keeps <pre> content as it is. Always test a page after replacing code.

    Related tools

    Make your stylesheets smaller with the CSS Minifier and your scripts with the JavaScript Minifier. Need SEO tags for the page head? Use the Meta Tag Generator.

    Frequently asked questions

    Will formatting change how my page looks?

    In almost all cases, no. The formatter adds line breaks and indentation between tags. Text inside elements such as pre and textarea, where spaces matter, is left unchanged.

    Does it fix broken HTML?

    No. It indents what is there and doesn’t add missing closing tags. Unclosed tags can make the indentation look uneven, which is a useful hint about where the problem is.

    Is my code uploaded?

    No. The HTML is formatted in your browser and never sent to our server.