No signup, runs in your browser
Free HTML formatter and beautifier
Paste your HTML and press Format HTML: each tag is indented by how it nests, and the CSS in <style> and the JavaScript in <script> are formatted too. Minify it to one line when you ship it. Your browser does the formatting, so your code is never sent to a server.
Formatting runs in your browser. Your code isn't sent anywhere.
How to format HTML
- Paste your HTML into the box above.
- Pick an indent: 2 spaces, 4 spaces, or a tab.
- Press Format HTML. Each tag is indented one step deeper than the tag it sits in, and the CSS and JavaScript inside are laid out line by line.
- Press Copy and paste the result back into your file.
What does formatting change?
Only whitespace: the line breaks and indentation between tags, and in the CSS and JavaScript. Tags, attributes, and text stay as they are, and the content of <pre> and <textarea> is left exactly as written.
How do I format HTML in VS Code?
Open the file and press Shift + Alt + F (Shift + Option + F on a Mac) to run Format Document. VS Code's HTML formatting is built on js-beautify, the formatter this page runs too. On a phone, or on a computer without an editor, paste the code here.
Should I indent with 2 spaces, 4 spaces, or tabs?
Use what your project already uses. With no rule to follow, take 2 spaces: Google's HTML/CSS style guide asks for 2 spaces and no tabs.
How do I minify HTML?
Press Minify. Comments and the whitespace a browser doesn't draw are removed, and the CSS in <style> is compacted. One space stays wherever words or inline tags meet, so nothing runs together, and <pre> and <textarea> keep their content. The size under the result shows what you saved.
Is my code uploaded?
No. Formatting and minifying run in your browser. Your code reaches Convika only when you press Publish as a link and then Get my preview link in the publish tool.
See the formatted page
Press Preview in the HTML viewer and the formatted code opens in Convika's HTML viewer, with its CSS and JavaScript running, on a phone or a computer.
Publish the formatted HTML
Press Publish as a link and the code goes into the paste box of the HTML publish tool. Press Get my preview link there for a private link that works for 3 minutes, with no signup.
Guides
ChatGPT, Claude, or Gemini gave me HTML code: how do I run it and see the page?
To run HTML code from ChatGPT, Claude, or Gemini, paste the whole code block into a free HTML viewer and it runs in your browser. Or save it as an .html file.
file://error_page_loaded.html, code, or a blank page: why your HTML file won't display
file://error_page_loaded.html is Chrome's error page on an iPhone or iPad, not your file. Why an HTML file shows code or a blank page, and each fix.
How to share an HTML file from VS Code as a link, with its CSS and JavaScript
Live Server's link opens only on your computer. To share an HTML file or a VS Code project as a link, put its CSS and JavaScript in one file and upload it.
How to open an HTML file on iPhone
Open an HTML file on iPhone in 3 steps: save it to Files, open a free HTML viewer in Safari, tap Choose an .html file. It runs with CSS and JavaScript.
How do I open an HTML file on iPad and make it run?
Open an HTML file on iPad in 3 steps: save it to Files, open a free HTML viewer in Safari, tap Choose an .html file. Its CSS and JavaScript run, no app.
How do I open an HTML file on Android in Chrome mobile?
Open an HTML file on Android: open a free HTML viewer in Chrome and tap Choose an .html file, or tap it in Files, choose Chrome, then Just once.
How to share an HTML file as a link that opens on any phone
Upload the file to a host and send its link; email and Google Drive send the code. 8 hosts compared, from Convika to Netlify Drop, with 4 steps.
How do I create a QR code for an HTML file?
To convert an HTML file to a QR code, publish it at an address that stays, then click Show QR code and download a PNG. The code holds a link, not the file.
How do I share an HTML file on Google Drive, or send it as a web page?
Share an HTML file on Google Drive: upload it, set it to Anyone with the link, and copy the link. People get the file, not a web page; Convika's free upload box turns it into one.
Submit an HTML file in Google Classroom so your teacher sees the page
Classroom takes an HTML file, but the teacher gets the file. Hand in a link to the page instead. Teachers post a game for their class the same way.
How do I send an HTML file on WhatsApp so it opens in one tap?
Send an HTML file on WhatsApp with Document and it arrives as a file. To share it so it opens as a page in their phone's browser, send a link instead.
How to send an HTML page on LINE so it opens in one tap
LINE's help doesn't say how a phone opens a received .html file, and LINE keeps files for a limited time. Send a link instead; it opens in a browser.