Skip to content

HTML Formatter

Format HTML with strict whitespace sensitivity, untouched embedded script/style bodies, readable parser errors and source/output comparison in your browser.

Choose your path

Built around the job you need to finish

Prepare a readable markup review while explicitly considering inline whitespace, preformatted text, raw-text elements and browser rendering.

Documentation author

Retain inline punctuation and preformatted text while reviewing markup.

Format inline/pre examples with strict whitespace, compare source/output and copy code only.

Text relationships remain visible and embedded script/style content is not reformatted as another language.

Markup reviewer

Separate syntax formatting from sanitization and accessibility.

Try mismatched tags and an event-handler attribute; recover from parser errors and read rendering boundaries.

Errors have no partial output; success makes no sanitization or conformance claim.

Mobile project editor

Review long markup and save a current handoff on a narrow screen.

Use stacked labeled editors, adjust indent, rerun and explicitly save source/result/rendering notes.

No horizontal page overflow or stale save after an input/settings change.

Authoritative checks for this tool

Outputs and checklists are planning aids. Review the linked current authorities and the records, terms, instructions, and requirements that apply to your exact situation before a consequential decision.

Was this tool helpful?

Reference & details

How it works

Whitespace-aware HTML printing

Prettier 3.9.6 uses strict HTML whitespace sensitivity with embedded formatting off. Parsed raw-text and preformatted bodies are restored exactly using source spans, with a 15,000-node limit. Other markup may normalize; test browser rendering separately.

Bounded local execution

An explicit run loads the language engine in a disposable worker. Cancellation and a wall-clock timeout prevent abandoned work from updating results. Input code is never executed.

Review current output

Input or option changes invalidate old output. Copy/download contain code only, not an appended report. Formatting is not automatic repair or runtime validation.

Updated: August 2026

Example Scenarios

Compare punctuation and spacing around strong, span and other inline markup before accepting a formatted document.

Review pre and textarea text, character references and comments without treating every angle bracket as a tag boundary.

Save reviewed source, formatted HTML and rendering warnings to the REST API Project; separately test the real page.

FAQ

Strict whitespace sensitivity avoids freely adding spaces between inline elements. Width is only a target; preserving text relationships can take precedence over a shorter line.

No. Formatting does not sanitize event handlers, validate a complete document or prove accessibility. Pasted HTML is shown as text, not inserted into a live preview.

Embedded script/style formatting is disabled in this route. Use the dedicated JavaScript or CSS formatter for those languages and test the resulting page yourself.

Code is processed in a local worker, not uploaded or automatically saved. Engine assets may need a connection on first use. An explicit Project save stores source, result and notes on this device; do not save secrets.

Input is limited to 100,000 characters and output to 300,000. Runs stop after 10 seconds. File imports are limited to 400,000 bytes; Project saves require source and output each within 100,000 characters. Editing input or settings requires a new run.

About HTML Formatter

Review HTML fragments or documents with strict whitespace sensitivity. Script and style formatting is disabled. The tool displays plain text only and never renders pasted HTML.