⚡ JavaScript Minifier & Beautifier

Minify, compress and beautify JavaScript code. Runs in your browser.

Last updated: November 8, 2026 · By the BoltQuickTools team

Stripping or restoring JavaScript whitespace

You want a quick way to shrink a small script for a page with no build step, or to reformat a minified file enough to read it. This page does both with a character-level scanner. It is not a full parser, and that shapes everything below, so read the semicolon warning before using its output in production.

The controls

  1. Paste code into Input JavaScript.
  2. Press Minify to remove comments and collapse whitespace, or Beautify to re-indent with two spaces.
  3. Read the result in Output JavaScript. The line below it shows original size, output size and, for Minify, the savings.
  4. Copy Output copies it, and Clear empties both boxes.

A small script, minified

// add two numbers
function add(a, b) {
  /* no validation */
  return a + b;
}
const label = "a  //  b";
console.log(add(2, 3), `sum: ${label}`);

Minify produces:

function add(a,b){return a+b;}const label="a  //  b";console.log(add(2,3),`sum: ${label}`);

The stats read Original: 146 chars (7 lines), Output: 91 chars (1 lines), Savings: 37.7%. The double slash inside the string survives, as does everything in the template literal.

What it keeps, and what it can still get wrong

A line break stays in the output wherever automatic semicolon insertion could depend on it, and a space stays between two identifier characters and between repeated plus or minus signs. The page does not parse the result, so "Minification complete" only means the scan finished. All of these came from running the tool:

InputOutputEffect
let a = 1 newline let b = 2let a=1 newline let b=2Still valid
return newline 1;return newline 1;Meaning unchanged
let d = a - -b;let d=a- -b;Still valid
if (x) /a b/.test(y);if(x)/a b/.test(y);A regular expression right after a closing parenthesis can be read as division, so its spacing changes

For production builds, use a parser-based minifier.

What else it will not do

Before you ship the output

How do I know the output still works?

Run it, or paste it into your editor or a linter. The page itself cannot tell you. The Code Diff Viewer can help you compare a re-beautified copy against the original.

Does the Savings figure match what users will download?

No. It compares character counts before any network compression. Try the GZIP tool to estimate transfer size.

Why is my output still several lines long?

Line breaks inside template literals are part of the string, so they are kept.

For stylesheets and markup, the CSS Minifier and HTML Beautifier do the same kind of cleanup.