Code & Data
Format HTML without changing how it renders
Paste HTML to indent it. Inline elements stay where they are, whitespace inside pre and textarea is preserved, and script bodies are re-indented rather than reflowed — because all three of those change the page if you get them wrong.
Indentation
Inline elements stay on their line, because moving them inserts whitespace the browser renders. Script and style bodies are re-indented but never reflowed.
Paste HTML above and the result appears here.
- Runs in your browser
- No account required
- Free to use
How it works
Moving an inline element changes the page
Putting a `<span>` on its own line inserts a newline the browser renders as a space. That is why `<p>Hello <b>there</b></p>` stays on one line here: a formatter that breaks it open has quietly edited the text, and it is the single most common way a beautifier damages a page.
Whitespace is content in some elements
Inside `<pre>` and `<textarea>` every space and newline is meaningful. Those elements are copied out exactly as written; everywhere else whitespace is formatting and is normalised.
Script and style contents are not markup
`if (a < b)` inside a script is not the start of a tag. Their bodies are recognised as text, re-indented as a block, and never reflowed — reformatting the JavaScript inside a page is a different job with its own ways to go wrong.
It never refuses your markup
HTML is defined to be recoverable, so unclosed tags, omitted `</li>` and stray closing tags are all handled the way a browser handles them rather than rejected. A formatter that only accepts perfect HTML is no use on the pages that need formatting.
What it does
Two, four spaces or tabs
Whatever your project uses.
Handles real-world markup
Void elements, omitted closing tags, attributes containing angle brackets and conditional comments all survive.
Comments kept, or dropped
Kept by default; one checkbox removes them.
Nothing leaves the page
Parsed in your browser and never uploaded — so an unreleased template stays on your machine.
Practical advice
Getting a better result
- Formatting the same document twice should produce identical output. If it does not, that is a bug worth reporting.
- If a page looks different after formatting, the cause is almost always whitespace around inline elements — this tool avoids that, but hand-editing afterwards can reintroduce it.
- Minified HTML formats back into something readable, which is a fast way to understand a page you did not write.
Questions
Things people ask
Will formatting change how my page looks?
It should not. Inline elements are never moved onto their own line, and pre and textarea contents are left byte for byte, which are the two ways formatting normally alters rendering.
Does it fix broken HTML?
It recovers from it the way a browser does — unclosed tags are closed, stray closing tags are dropped — but it does not report the problems. If you want strictness, that is what the XML formatter gives you.
Does it reformat my JavaScript?
No. Script and style bodies are re-indented as a block so they sit correctly in the page, but their contents are otherwise untouched.
Related tools
JSON Formatter
Format and minify JSON, with errors that name the line.
Runs entirely in your browser
Open toolJSON Validator
Check JSON and get the line, column and cause of any error.
Runs entirely in your browser
Open toolJSON Viewer
Explore JSON as a collapsible tree instead of scrolling it.
Runs entirely in your browser
Open toolJSON to CSV
Turn an array of objects into a spreadsheet-ready CSV.
Runs entirely in your browser
Open toolWho builds these
Free tools by day. Websites that earn their keep by trade.
KuConvert is built by KUDUY, a web design and development agency. From custom WordPress builds to SEO and e-commerce, everything they do is engineered to bring you more qualified traffic and turn it into revenue.
Web Design
Custom, conversion-focused web design that captivates visitors and turns them into paying customers. Mobile-first, fast, and built to rank.
Web Development
Custom WordPress websites built with clean code, blazing-fast performance (Core Web Vitals optimised), and enterprise-grade security.
E-Commerce
Online stores that convert visitors to customers with seamless shopping experiences.
SEO
Technical SEO, keyword research, on-page optimisation and local SEO strategies that drive qualified organic traffic.
Digital Marketing
Data-driven campaigns that deliver measurable ROI across every channel.
Branding
Memorable brand identities that stand out in any market and build lasting trust.
Website Help
One-on-one expert support for bug fixes, updates and ongoing maintenance — without a long-term retainer.
Fixed scope, no surprise invoices
Most sites ship in four to eight weeks with the scope and the price agreed up front.
SEO from day one
Search is designed into the build — structure, schema and Core Web Vitals — not retrofitted.
A team, not a ticket queue
A project manager, a designer and a developer you can actually reach.
Need your whole site to load this fast?
Images are usually the heaviest thing on a page and the easiest win. KUDUY works on site speed, image delivery and Core Web Vitals for teams who would rather not do it by hand.
This tool runs entirely in your browser. Your files are never uploaded.