Zum Hauptinhalt springen

HTML-Formatierer

Strukturiere und formatiere deine HTML-Dokumente sauber.

Läuft in deinem Browser; deine Daten verlassen dein Gerät nieKostenlos, ohne Anmeldung
Options
Formatted HTML

The formatted HTML will appear here.

So funktioniert es

Your markup is processed by js-beautify, the library behind most beautifier tools, battle-tested for decades. Nested elements are indented one level deeper than their parents, attributes stay on their tag, and embedded <style> and <script> blocks are formatted with their language's own rules.

Text content and entities are never modified. Only whitespace and line breaks change.

Funktionen

  • Language-aware: embedded CSS and JS formatted too
  • 2 or 4 space indentation
  • Optional line wrapping with a max line length
  • Entities and text content preserved exactly
  • 100% client-side, nothing leaves your browser

So wird es verwendet

  1. Paste HTML, or upload a .html file.
  2. Choose indentation, line wrapping and empty-line handling.
  3. Press Format HTML, then copy the result or download it as a file.

Beispiel

Input:  <div><p>Hello</p><span>world</span></div>
Output: <div>
          <p>Hello</p><span>world</span>
        </div>

Häufig gestellte Fragen

Does it format the CSS and JavaScript inside my HTML?
Yes. <style> blocks are formatted as CSS and <script> blocks as JavaScript. The formatter is language-aware and handles all three layers of an HTML document in one pass.
Does the formatter validate my HTML?
No, it is a formatter, not a validator. It re-indents and re-flows markup without checking tag structure, so unclosed or misnested tags are left as they are. Use it to make markup readable, not to check it is correct. For that, run your page through an HTML validator.
What does the max line length option do?
When set to a number greater than zero, long lines are wrapped at or before that column. Set it to 0 to disable wrapping entirely, and every tag stays on the line the formatter puts it on.
Are entities and special characters preserved?
Yes. Entities like &amp; and character references pass through untouched, and nothing is re-encoded. Your text content is exactly what you pasted, and only whitespace and line breaks change.
Is my HTML sent to a server?
No. Formatting happens entirely in your browser with JavaScript. Nothing you type is transmitted anywhere, and you can verify this in your browser's network inspector.