EN
My tools

HTML Formatter / Beautifier

Beautify HTML: indent blocks, keep inline text and <pre> intact, wrap long lines and attributes, and re-indent embedded CSS and JavaScript.

0 = never wrap. Text is only broken where it already has a space.
Formatted HTML

20 elements · 32 lines · 560 → 734 characters

My tools →
Advertisement

Minified or hand-edited HTML is hard to read and harder to debug. The formatter puts each block element — sections, headings, paragraphs, lists, tables — on its own line with consistent indentation, while text and inline tags such as links and bold stay together in their sentence. Inline CSS and JavaScript can be re-indented too.

How to use this tool

  1. Paste your HTML.
  2. Pick 2 spaces, 4 spaces or tabs, and a line length for wrapping long text (0 turns wrapping off).
  3. Choose when attributes go on separate lines and whether to re-indent inline style and script code.
  4. Copy the formatted HTML; the note below it lists unclosed or stray tags with their line and column.

Formula

block element → own line, children one level deeper; inline content → one line, wrapped only at existing spaces; <pre>, <textarea> → copied exactly

In HTML a line break counts as a space, so adding one between two inline tags (for example <b>a</b><i>b</i>) would put a visible space between the words. The formatter therefore only adds line breaks around block elements, where browsers ignore whitespace, and only wraps text where a space already exists. End tags that HTML lets you omit, such as </li> or </p>, are not added.

Example

The sample page comes out as 32 lines: <html>, <head> and <body> each on their own line, <header>, <nav> and <main> indented beneath, the sale paragraph kept on one line with its <strong> and <time> inline, both list items on their own lines without inventing </li>, the <pre> block untouched, and the script body re-indented by its braces.

Frequently asked questions

Will formatting change how my page looks?

It should not. Line breaks are only added where HTML ignores whitespace by default, <pre> and <textarea> content is copied exactly, and attribute values and text are never rewritten. Whitespace inside inline elements is reduced to single spaces, which is how browsers render it anyway. The exception is CSS that changes how elements display: if your stylesheet makes list items or divs inline-block, or sets white-space: pre on an ordinary element, the added line breaks can show as small gaps or extra lines there.

Does it fix broken HTML?

No, it keeps your markup as written. Unclosed elements and stray end tags are listed in the note with their positions so you can fix them; use the HTML validator for a full check.

Is my HTML uploaded?

No. Formatting happens in your browser, so templates and private pages stay on your device.

Last updated:

Cite or embed this tool
APA

kakaoCalc. (2026, November 8). HTML Formatter / Beautifier. https://kakao.mobile/tools/html-formatter/

MLA

“HTML Formatter / Beautifier.” kakaoCalc, 8 Nov. 2026, kakao.mobile/tools/html-formatter/.

Paste this code into your page. The widget runs in your visitors' browsers, shows no ads and keeps a link back to this page. Embedding terms

Advertisement