HTML Beautifier

Turn messy, minified or copy-pasted HTML into neatly indented, readable markup. Inline <style> and <script> blocks are formatted too.

In your browserFree
Indent
Wrap lines at

Paste or type to begin. Everything runs in your browser.

How it works

How to use the HTML Beautifier

  1. 01

    Paste HTML, drop an .html file onto the input, or load the sample.

  2. 02

    Choose an indent and whether long lines should wrap. Inline scripts and styles are formatted too.

  3. 03

    Copy the clean markup or download it as an .html file.

About this tool

What does an HTML beautifier do?

An HTML beautifier takes unstructured or minified HTML and reformats it with consistent indentation, line breaks and spacing, so the nesting of elements is obvious at a glance. It's invaluable for developers, webmasters and anyone working with templates, email HTML, CMS exports or code copied from browser DevTools.

Well-formatted HTML is easier to debug, review and share with your team. You can spot unclosed tags, misplaced elements and accessibility issues faster, and keep a consistent code style across a project.

  • Full document support

    Formats whole pages or fragments, including inline CSS and JavaScript.

  • Your style

    2 spaces, 4 spaces or tabs, with optional line wrapping at 80 or 120 characters.

  • Inline tags stay inline

    Keep <a>, <strong> and other inline elements on the same line as their text.

  • Upload and download

    Open .html files directly and save the result as a file.

FAQ

Frequently asked questions

Will beautifying change how my page looks?

In almost all cases, no. Only whitespace between tags changes. Whitespace inside <pre> and <textarea> is preserved.

Can it format HTML email templates?

Yes. Table-heavy email HTML is formatted the same way, which makes nested tables much easier to follow.

Does it fix invalid HTML?

It reformats what's there but doesn't rewrite your markup. Clear indentation does make unclosed or misplaced tags much easier to spot.

Are my files uploaded anywhere?

No. This tool runs entirely in your browser using JavaScript. Your files and text never leave your device, so it's safe for private or confidential work.

Missing something?

Tell us the tool you wish existed.

Instant.tools grows from real requests. Describe the task you're stuck on and we'll consider building it next.

Search Instant.tools

Suggested
Image CompressorPopularCompress PNG, JPG and SVG files in lossless or lossy mode so your pages load faster.ImagesMeta Tags GeneratorPopularPreview and generate Open Graph, Twitter and SEO meta tags for how your site appears when shared.UtilitiesQR Code GeneratorNewTurn links and text into a QR code you can download and print.UtilitiesImage ConverterNewConvert images between common formats in a few clicks.ImagesImage CropperNewCrop images to an exact size or aspect ratio.ImagesImage SearchNewSearch for free images to use in your projects.ImagesHEIC to JPGNewConvert iPhone HEIC photos to JPG, PNG or WebP in bulk, with location data removed.ImagesResize ImageNewResize images to exact pixels, a percentage or a longest side, in bulk, with sharp results.ImagesCompress Image to KBNewShrink images under an exact size like 20 KB, 50 KB or 200 KB for forms and uploads.ImagesRemove Photo MetadataNewSee and strip hidden EXIF, GPS location and camera data from photos without re-compressing them.ImagesMerge PDFNewCombine PDFs into one file, reorder them and pick exactly which pages to keep from each.DocumentsSplit PDFNewSplit a PDF into single pages, page ranges or equal parts, or extract the pages you select.DocumentsOrganize PDFNewReorder, rotate and delete PDF pages visually, then save a clean new file.DocumentsJPG to PDFNewTurn JPG, PNG and WebP images into one PDF with page size, orientation and margins.DocumentsPDF to JPGNewConvert PDF pages to high-resolution JPG or PNG images, all pages or just the ones you pick.DocumentsCompress VideoNewShrink videos to a target size for WhatsApp, Discord or email, and see the result size before you start.VideoCompress PDFNewShrink PDFs by recompressing the images inside them, while text and vector graphics stay sharp.DocumentsPDF to WordNewTurn a PDF's text into an editable Word document, with headings, paragraphs and page breaks.DocumentsSign PDFNewDraw, type or upload your signature and place it anywhere on a PDF, plus dates and initials.DocumentsOCR PDFNewMake scanned PDFs searchable and copyable by recognising the text on every page.DocumentsProtect PDFNewAdd a password with AES-256 encryption and control printing and copying, or remove a password you know.Documentsllms.txt GeneratorPopularNewWrite and validate an llms.txt file that points AI tools to your site's most useful pages.AIAI Crawler CheckerNewSee which AI crawlers (GPTBot, ClaudeBot, PerplexityBot and more) your robots.txt allows or blocks.AIJSON-LD GeneratorNewBuild schema.org structured data for articles, products, FAQs, events and more, with built-in checks.AILLM Token CounterNewCount tokens and estimate cost for GPT, Claude, Gemini and Llama prompts, with exact counts where tokenizers are public.AIMCP Config GeneratorNewGenerate MCP server config for Claude, Cursor, VS Code, Windsurf and Zed from one form.AIJSON Schema GeneratorNewGenerate a JSON Schema from example JSON, then validate data against it.DeveloperAI Prompt BuilderNewStructure prompts with a role, task, context, constraints, output format and examples, with reusable variables.AIAI Readiness CheckerNewScore how well a page can be read, understood and cited by AI search and assistants.AI
Categories
Developer toolsFormat, minify and inspect HTML, CSS, JavaScript and JSON.15 toolsImage toolsCompress, convert, crop and find images for the web.11 toolsPDF toolsMerge, split, organise and convert PDFs right in your browser.10 toolsAI toolsGet sites, data and prompts ready for AI: llms.txt, crawler access, tokens, schemas and MCP.8 toolsCalculators & convertersConvert between image, document, data and colour formats in a click.7 toolsUtility toolsQR codes, website screenshots, SEO tags and other handy helpers.6 toolsDesign & color toolsColour conversion, favicons and visual assets for your brand.3 toolsText & writing toolsCount, check and shape your words and copy.3 toolsVideo toolsCompress and prepare video files without uploading them.1 tools