Skip to content

HTML Formatter

Runs in your browser

Indent tangled markup so you can read it, or strip comments and whitespace to ship it.

Input

Output

Formatting…

How this one works

Beautify puts each block element on its own line and indents children inside their parents, so the structure of a page is visible at a glance. Inline elements such as links and <strong> stay in the flow of their text.

Minify removes comments and the whitespace the browser would not draw: line breaks and indentation around block elements such as <div> and <li>. A space between two inline elements, such as two links in a row, is kept as one space, because removing it would join the words. Attribute values and the contents of <pre>, <textarea>, <script> and <style> are left exactly as they are, because whitespace there does matter.

Questions

Will minifying change how my page looks?

It shouldn't. Whitespace next to block elements doesn't render, so it is removed. Runs of whitespace in text become a single space, which is what the browser shows anyway, and a space between two inline elements stays. Attribute values, preformatted blocks, scripts and styles are left untouched.

Does it minify the CSS and JavaScript inside the page too?

No. Inline <style> and <script> contents are preserved as written, so nothing inside them can break. Use the CSS Formatter or JavaScript Formatter to minify those separately.

Will it fix broken HTML?

No. Beautify indents whatever it is given and doesn't check that tags are closed or correctly nested, so a missing </div> shows up as indentation that never steps back out. That is often the quickest way to find it.

Is my HTML uploaded anywhere?

No. Formatting runs as JavaScript in your browser tab. Nothing is sent to a server, and nothing is stored after you close the page.

Keyboard shortcuts

Global

  • Show this shortcuts dialogShift?
  • Toggle light / dark themeCtrlShiftL
  • Close dialogsEsc

Formatter & Validator

  • Format JSONCtrlEnter
  • Minify JSONCtrlShiftM
  • Copy outputCtrlShiftC
  • Download output as .jsonCtrlShiftS
  • Clear input and outputCtrlShiftX

Tree Viewer

  • Focus the search box/
  • Expand all nodesCtrlShiftE
  • Collapse all nodesCtrlShiftR

Diff

  • Swap document A and BCtrlShiftS

Time & date tools

  • Use the current time (Epoch Converter)CtrlEnter
  • Copy the main resultCtrlShiftC
  • Clear the inputCtrlShiftX

PHP Unserialize & Serialize

  • Convert an input over 2 MBCtrlEnter
  • Copy outputCtrlShiftC
  • Download outputCtrlShiftS
  • Clear input and outputCtrlShiftX

Keys & IDs

  • Generate a new token or UUID batchCtrlEnter
  • Copy the resultCtrlShiftC

JSON tools

JSON FormatterPretty-print or minify
JSON ValidatorCheck strict JSON validity
JSON Tree ViewerBrowse JSON as a tree
JSON DiffCompare two documents
JSON Path FinderExplore JSONPath expressions
JSON to CSVFlatten JSON into rows
CSV to JSONTurn rows back into objects
PHP UnserializeSerialized PHP to JSON
PHP SerializeJSON to serialized PHP

JWT tools

JWT DecoderClaims, signature and expiry
JWT VerifierWith a secret, PEM key or JWKS
JWT Expiry Checkeriat, nbf and exp in local time
JWT GeneratorBuild a signed test token
Base64URL EncoderEncode or decode a segment

Time & date tools

Epoch ConverterTimestamps to real dates
Cron Expression ExplainerCron in plain English
Time Zone ConverterOne moment, many cities
Duration CalculatorDate maths and durations

Keys & IDs

Password GeneratorSecure random secrets
UUID Generatorv1, v4, v5 or v7 UUIDs

Code formatters

SQL FormatterBeautify or minify SQL
HTML FormatterBeautify or minify HTML
CSS FormatterBeautify or minify CSS
JavaScript FormatterBeautify or minify JS
PHP FormatterBeautify PHP code
Markdown to HTMLConvert with a live preview

AI tools

Token CounterTokens for every model
Prompt Secret ScrubberHide keys and personal data

Pages

JSON toolsFormat, validate, compare and convert JSON.
JWT toolsDecode, verify and generate JSON Web Tokens.
Time & date toolsConvert timestamps, read cron, compare zones.
Keys & IDsGenerate secure tokens, passwords and UUIDs.
Code formattersFormat SQL, HTML, CSS, JavaScript and PHP code.
AI toolsCount tokens and hide secrets before you prompt.
HomePopular tools and categories
All categoriesBrowse tools by category
AboutWhat ToolJar is and why
PrivacyWhat is and is not collected

Theme

Switch to light theme
Switch to dark theme