$code-formatter
Beautify or minify HTML, CSS, and JavaScript. Pick the language, pick an action, paste your code — everything runs in your browser.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Example</title>
<meta charset="utf-8">
<link rel="stylesheet" href="/app.css">
</head>
<body>
<main class="wrap">
<h1>Hello</h1>
<p>
Welcome to
<strong>MakeMyDev</strong>
. Try pasting a minified file to see it expand.
</p>
<ul>
<li>First</li>
<li>Second</li>
<li>Third</li>
</ul>
<pre> this whitespace is preserved</pre>
</main>
</body>
</html>
How to format and minify HTML, CSS, and JavaScript
Paste any HTML, CSS, or JavaScript into the input panel, pick Beautify for a consistently indented version or Minify to strip comments and whitespace. Everything happens in your browser — nothing is uploaded, nothing is logged.
- Pick a language. HTML handles full documents or fragments. CSS handles stylesheets, including at-rules like @media and @supports. JavaScript handles ES2015+ syntax: classes, arrow functions, template literals, async/await, and regular expressions.
- Beautify or minify. Beautify re-indents nested structure for readability. Minify strips comments and collapses whitespace so the code fits through systems that dislike line breaks — JSON fields, environment variables, or URL query strings.
- Pick indent. 2 spaces is the default; 4 spaces matches many team style guides; tabs work in editors where width is configurable.
- Copy, download, or iterate. Output updates live. Copy to clipboard for a quick paste, or download as a file with the correct extension.
What each formatter handles
- HTML — full documents (with DOCTYPE) or fragments. Void elements (br, img, input, meta, link…) are recognized automatically. Contents of <pre>, <textarea> are preserved verbatim. Inline elements (a, span, em, strong, code…) stay on one line with their surrounding text when short.
- CSS — selectors, nested at-rules (@media, @supports, @keyframes), declarations with !important, comma- separated selector lists, and comments. Bang comments (/*! … */) survive minification so license headers stay intact.
- JavaScript — tokens are parsed so that strings, template literals, regex literals, and comments are preserved exactly. Minification drops comments, merges whitespace, and inserts line breaks where needed to keep ASI-sensitive statements safe (return, throw, and lines starting with (, [, or /).
When to reach for a dedicated tool
This formatter is built for quick copy-paste work — debugging a minified stylesheet, expanding a one-line snippet from a blog post, or shrinking a config value for a query string. For production builds, a dedicated minifier (esbuild, terser, swc, lightningcss) will produce smaller output with safer transformations because it parses the full language grammar. Treat this tool as a fast diagnostic aid, not a replacement for your build pipeline.
Limitations
The JavaScript beautifier is brace-based — it does not parse expressions, so binary operators retain their original spacing and object literals are always expanded multi-line. The HTML beautifier keeps contents of <script> and <style> blocks as written (it does not re-format them). If you need those re-formatted, switch the language to CSS or JavaScript and paste the inner contents directly.