HTML Formatter & Minifier

Format, minify, inspect, compare, and download HTML documents or fragments with practical source controls.

Workspace

Source transformation

Choose the result

0 lines0 elements0 / 2,097,152 bytes
0 lines0 elements0 bytes

Source review

Structure and size

HTML fragmentNo HTML DOCTYPE
0elements
0comments
0script elements
0style elements
0duplicate IDs

The result remains source text. Formatting or minifying does not validate application behavior or make untrusted markup safe.

Guide

How to use

  1. Paste, open, or load an HTML document or fragment.
  2. Choose Format or Minify, then configure indentation, wrapping, whitespace, comments, attributes, optional tags, and embedded-code options as needed.
  3. Run the operation and compare line, element, and byte details while reviewing duplicate IDs and size change.
  4. Copy, download, or move the source result back into the input editor.
Help

Frequently asked questions

Does this tool sanitize HTML?

No. Formatting and minification change source layout and optional syntax only. They do not remove every unsafe element or make untrusted markup safe to publish.

Can it format fragments as well as complete documents?

Yes. You can process a complete document with a DOCTYPE and html element, or a fragment such as a component, table, form, or email block.

Which whitespace option should I choose?

Follow CSS display rules is a balanced default. Preserve sensitive whitespace makes fewer wrapping changes. Allow more wrapping is useful when compact, aggressively wrapped source is preferred.

Are embedded CSS and JavaScript changed?

Formatting may lay out embedded blocks. Minification changes embedded CSS or JavaScript only when you explicitly enable those options.

Why are duplicate IDs reported?

An id value should identify one element in a document. Duplicate IDs can make labels, links, styles, and scripts target an unexpected element.