About HTML Formatter
An HTML formatter helps when markup arrives as one long line or with random indentation: the source of a page you copied with View Page Source, a template exported from a page builder, an HTML email, or a snippet pasted out of a CMS editor. Paste the code or open a file, and the formatted version appears as you type, indented with 2 spaces, 4 spaces or tabs.
Block tags such as div, p, ul and table go on their own lines, while inline tags like a, span, b and em stay in the text, so sentences aren't chopped into pieces. Anything inside pre and textarea is left exactly as it was, because spacing matters there. Embedded style and script blocks are formatted too, unless you untick Also format CSS and JavaScript inside, and comments are kept. To shrink a page instead, use the HTML Minifier. The code never leaves your browser, and the tool keeps working offline once the page has loaded.
How to use HTML Formatter
- 1Paste your HTML
Paste the markup into the box or open an HTML file from your computer.
- 2Pick the indent
Choose 2 spaces, 4 spaces or tabs, and the HTML formatter updates the result at once.
- 3Copy or download
Copy the formatted HTML or download it as a file.
Why use Cubfile for this
- Sensible line breaks
Block tags get their own lines, and inline tags such as a, span and em stay in the text.
- Pre and textarea kept
Content where spacing matters is left exactly as you wrote it.
- CSS and JS inside too
Embedded style and script blocks are formatted along with the markup, an option that's on by default.
- Private and offline
Runs in your browser, uploads nothing and keeps working without a connection once loaded.