Skip to content
yutils
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 Tidy
  • Prettier 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 release
  • HTML 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