HTML Formatter
Beautify and format HTML code with proper indentation
Ctrl + Enter to re-format
Formatted HTML will appear here
Paste HTML above to begin
Advertisement
Free HTML Formatter powered by Prettier: beautify messy or minified HTML online with 2-space, 4-space or tab indentation. Runs in your browser, no upload.
Beautify and format HTML code with proper indentation
Ctrl + Enter to re-format
Formatted HTML will appear here
Paste HTML above to begin
HTML Formatter is a free online HTML beautifier powered by Prettier. Paste compressed or messy HTML and get clean, properly indented markup, with a choice of 2-space, 4-space or tab indentation. Prettier also formats embedded script and style blocks, everything runs client-side in your browser, and you can download the result.
What you get with HTML Formatter.
Nested tags are automatically indented to the correct depth.
Choose 2 spaces, 4 spaces, or tabs.
Inline <script> and <style> blocks are formatted along with your markup.
HTML is formatted locally in your browser with no server uploads.
Follow these steps to get the best results.
Paste compressed or messy markup into the input — formatting runs automatically.
Pick 2 spaces, 4 spaces, or tabs to match your project.
Copy the formatted HTML or download it as a file.
Advertisement
Common questions about HTML Formatter.
No — only whitespace and indentation are adjusted. Tag names, attributes, and content are never modified.
Yes — Prettier's HTML parser understands embedded <script> and <style> blocks and formats them appropriately.
No. Prettier controls line width and attribute wrapping here. The available setting is indentation: 2 spaces, 4 spaces, or tabs.
The formatter works best with plain HTML5. Template syntax may cause parsing errors — format the HTML structure separately if needed.
It uses Prettier's HTML formatter, so the output matches what Prettier produces with the same indentation settings. You get the result in your browser without installing Prettier or setting up a project. For automatic formatting in your editor or CI, install Prettier locally.
Advertisement
Comments
Share feedback, ask questions, or help others use this tool.
Join the discussion
Sign in to comment, reply, and report inappropriate content.