Developer tools

HTML formatter

Format HTML locally with readable indentation, line wrapping and attribute controls. Preserve embedded code and preformatted sections, then copy or download the result.

Line width, spacing and attributes

40–200 characters; long values may exceed it.

Standard mode uses default HTML display behavior. Choose significant spacing if custom CSS changes how tags flow; line breaks may then appear inside tags.

Paste an HTML document or fragment, or import one UTF-8 file up to 1 MiB.

Source: editor text.

Import an HTML file or drop it here

Choose your formatting options and format when ready.

Readable source with useful choices

Use two spaces, four spaces or tabs, a preferred line width, and optional one-attribute-per-line formatting. Line width is a wrapping preference rather than a hard limit. Standard spacing follows default HTML display behavior; significant-spacing mode is more conservative around tags. Test the result in your own page when custom CSS makes whitespace important.

The original source stays in the input editor. Import, example, clear, large paste and Use output as input provide one Undo replacement, retained when you change formatting options. Undo restores the saved formatting and editor-wrap choices along with the input and its source filename. Ordinary edits clear that replacement history and identify the input as editor text. Invalid input remains available for correction; edits cancel obsolete processing and disable stale exports.

Embedded code and preformatted sections stay intact

Script, style, pre, textarea, title, raw-text sections, SVG and MathML are preserved from the source after normalizing line endings. Nested protected sections are kept together. These blocks are not reformatted internally, even when attribute formatting is enabled. Close protected elements explicitly so their boundaries can be matched.

HTML outside those sections may have its tag spelling, quotes, optional closing tags and structural whitespace normalized. Parser notices identify markup to review, with up to twenty locations you can select. This is a formatter, not a complete HTML validator, accessibility checker, sanitizer or minifier. Plain HTML documents and fragments are supported; use tools for their own languages for JSX, Vue, Angular or server-template syntax.

Local files and output

Source is processed as text in a local worker. It is not rendered, scripts are not executed, links are not followed, and nothing is uploaded or saved automatically. Files must be UTF-8; any HTML charset declaration must agree. Downloads use UTF-8, LF line endings and a final newline. A leading byte-order mark is removed with a notice.

Input is limited to 1 MiB, output to 4 MiB, parsed nodes to 50,000 and parsed element depth to 100. The worker and file reader can be cancelled and have ten-second deadlines. Reading or formatting failures preserve your input.

Formatting uses Prettier options with a local preservation step. Prettier license.