Format, minify, and validate HTML with attribute sorting and template support.
Free online HTML formatter and beautifier. Paste your HTML, choose indentation style (2 or 4 spaces, tabs), configure attribute wrapping and sorting, and format instantly. Supports Handlebars, EJS, and Jinja template syntax. Minify HTML for production, validate structure with error detection, convert HTML to JSX for React projects, or clean up messy markup from CMS editors. Formats embedded CSS and JavaScript automatically. Runs entirely in your browser — no data is ever sent to a server.
Keywords: html formatter, html formatter online, html beautifier, html minifier, html validator, format html online, html prettifier, html beautify, html indent, html pretty print, html minify online, html to jsx, html cleanup, html tidy, beautify html, minify html, html code formatter, html formatter free, online html beautifier, html attribute sorter
Tags: html, format, beautify, minify, validate, prettify, jsx
Paste your HTML into the input area on the left, or upload an .html file using the upload button. You can also drag and drop a file directly onto the input area.
Choose your indentation style — 2 spaces, 4 spaces, or tabs — and configure attribute wrapping mode (auto, force, expand, aligned, or preserve).
Optionally enable Sort Attributes to alphabetically order all HTML attributes on each element for consistent, diff-friendly output.
Click the Format button or press ⌘↵ (Mac) / Ctrl+Enter (Windows) to beautify your HTML instantly with syntax highlighting.
Use Minify to collapse the HTML to a single line for production embedding, Validate to check for structural errors, → JSX to convert to React-compatible syntax, or Cleanup to remove deprecated tags and inline styles.
Copy the formatted output with ⌘⇧C, download it as an .html file, or use the Share button to generate a gzip-compressed shareable URL.
HTML formatter with configurable indentation: 2 spaces, 4 spaces, or tabs to match your team's coding standards.
5 attribute wrapping modes: auto (wrap when line exceeds threshold), force (one attribute per line), force-expand (always one per line), force-aligned (aligned to first attribute), and preserve (keep original formatting).
Sort Attributes: alphabetically orders all HTML attributes for consistent, diff-friendly, and code-review-friendly output.
HTML minifier: collapses formatted HTML to a single line by removing whitespace, comments, and unnecessary characters for production use.
HTML validator with structural checks: unclosed tags, mismatched nesting, duplicate IDs, missing alt attributes, deprecated tags, and invalid element nesting.
HTML to JSX converter: transforms class to className, for to htmlFor, style strings to style objects, boolean attributes, and comments to JSX comments — ready for React projects.
HTML cleanup: removes inline styles, empty elements, deprecated tags, and editor cruft from CMS-generated HTML.
Embedded CSS and JavaScript formatting: automatically formats inline <style> and <script> blocks within your HTML.
Template syntax support: handles Handlebars {{ }}, EJS <% %>, and Jinja {% %} template literals without breaking formatting.
Syntax highlighting with color-coded tags, attributes, values, comments, entities, and template expressions.
Document type detection: automatically identifies full HTML documents, fragments, and template files.
HTML statistics: element count, nesting depth, and output byte size displayed as meta badges.
Shareable URLs: gzip-compresses your HTML into a URL parameter so you can share documents with teammates.
Works entirely in your browser — no HTML is ever sent to any server. Your markup stays completely private.
Keyboard shortcuts for power users: ⌘⇧F to format, ⌘⇧M to minify, ⌘⇧V to validate, ⌘⇧K to clear.
Large-input warning with byte count — alerts you when the input may slow down formatting.
Auto-format on type: toggle live formatting as you type with the Auto Format checkbox.