Example
Input (minified HTML)
<div class="card"><h2>yutils</h2><p>browser <strong>tools</strong></p></div>
Output (formatted)
<div class="card"> <h2>yutils</h2> <p>browser <strong>tools</strong></p> </div>
Note
Content inside `<pre>` and `<code>` is preserved. Toggle minify mode if you need the opposite direction.
Usage / FAQ
When to use
- Make email templates and CMS-exported HTML readable
- Unfold one-liner HTML generated by an AI
- Unpack production HTML emitted by Webpack / Vite
- Normalize indentation for PR-review-friendly diffs
- Use minify mode for a quick first-pass production compress
FAQ
- Q.Does this change the HTML content?
- A.No. Only whitespace and line breaks change. Attribute order, tag names, and text content stay intact.
- Q.What about code inside `<pre>`?
- A.Content inside `<pre>`, `<code>`, `<script>`, and `<style>` is preserved — indentation is meaningful there, so the formatter leaves it alone.
- Q.What if the HTML is malformed?
- A.The formatter does not enforce validity. Missing closing tags are handled best-effort but the result may look off.
Fun facts
HTML Tidy was created in 1998 by Dave Raggett (W3C), one of the co-authors of HTML 4.0 — built to auto-clean malformed HTML against the spec. It moved from the W3C to SourceForge in 2015, and the tidy-html5 fork continues modern HTML5 support.
HTML TidyPrettier was created in 2017 by James Long as an opinionated formatter — slogan: 'arguments about code style waste time, the tool decides.' Options are deliberately minimal to shut down bikeshedding (those endless debates over the small stuff) at the tool level.
Prettier 0.0.10 releaseHTML boolean attributes (`disabled`, `checked`, `required`, etc.) don't require values — `<input disabled>` equals `<input disabled="disabled">`. Formatters disagree on how to render these; Prettier always uses the short form (`<input disabled>`) — choosing simplicity.
WHATWG — Boolean attributes
Related tools
- JSON Formatter / Validator
Format, validate, and minify JSON strings. Adjust indent and optionally sort keys. Runs entirely in your browser.
- String Case Converter
Convert strings between camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE, and Title Case — all six cases shown side-by-side.
- Regex Tester
Test JavaScript regular expressions with live match results. Supports g/i/m/s/u/y flags and capture groups.
- Markdown Preview
Render Markdown to HTML side-by-side. Supports CommonMark + GFM (tables, fenced code, task lists). marked is lazy-loaded.
- HTML → Markdown
Convert HTML into Markdown. Headings, lists, links, code, tables, blockquotes. Uses the browser's DOMParser — accurate, 0 dependency.
- YAML ↔ JSON
Convert between YAML and JSON. Tolerates comments and multiline strings on the YAML side. yaml is lazy-loaded.
- Text Diff
Compare two texts and highlight added/removed lines, words, or characters.
- JSON Diff
Compare two JSON values, with optional key sorting and JSON-aware error messages.
- CSV ↔ JSON
Convert between CSV and JSON. Handles quoted fields, custom delimiters, and header rows.
- SQL Formatter
Format SQL queries with proper indentation and keyword casing. Supports PostgreSQL, MySQL, SQLite, and standard dialects.
- XML Formatter
Pretty-print or minify XML with attribute preservation. Handles SOAP, sitemaps, and config files.
- XML ↔ JSON
Convert between XML and JSON with attribute and element handling.
- Smart Paste
Paste any text and get tool recommendations — JSON, JWT, Base64, URL, UUID, Cron, and 9 more types auto-detected.
- Lorem Ipsum
Generate placeholder text in words, sentences, or paragraphs. Classic Lorem Ipsum or randomized.
- JSON Path
Query JSON with JSONPath expressions ($.store.book[*].author etc.) and inspect matches.
- JSON Schema Validator
Validate JSON data against a JSON Schema (Draft 2020-12). Powered by Ajv with format support.
- JSON Schema Generator
Generate a JSON Schema (Draft 2020-12) from a sample JSON. Infer types, required fields, and nested structures automatically.
- CSS Formatter
Beautify or minify CSS with proper indentation. Configurable selector and property style.
- JavaScript Formatter
Beautify or minify JavaScript with brace style and indent options. Powered by js-beautify.
- TOML ↔ JSON
Convert between TOML (Tom's Obvious Minimal Language) and JSON. Used in Cargo.toml, pyproject.toml, etc.
- INI ↔ JSON
Convert INI configuration to JSON and back. Supports sections, comments (; or #), and key=value.
- JSON → TypeScript
Generate TypeScript interfaces from a JSON sample. Nested objects become separate interfaces.
- JS Object → JSON
Convert a JavaScript object literal (unquoted keys, single quotes, trailing commas, comments) into standard JSON. Lenient parser, strict output.
- Slug Generator
Convert text into a URL-safe slug. Configurable separator, lowercase, and accent stripping.
- ASCII Tree
Convert indented text or path list into a box-drawing tree (├── │ └──).
- Diff Patch
Generate a unified diff (-u) patch from two text inputs. Compatible with `git apply` / `patch -p0`.
- Mock Data
Generate fake JSON records — names, emails, UUIDs, dates, and more. 0 dependency.
- MongoDB Extended JSON
Convert MongoDB Extended JSON (EJSON) between Canonical and Relaxed forms, or strip BSON wrappers to plain JSON. Recognizes 16 wrapper types ($oid/$date/$numberLong/$numberDecimal/$binary/...).