HTTPfy

JavaScript Minifier/Beautifier

Compress or format JavaScript.

Select Action
JavaScript Minifier/Beautifier Ready

About JavaScript Minifier/Beautifier

JavaScript Minifier and Beautifier

Paste JavaScript, choose minify or beautify, and copy the output. Minify strips comments and whitespace to shrink the file. Beautify takes compressed or messy code and lays it out with consistent indentation and line breaks.

Minify

The minifier uses jsmin. It removes comments, line breaks and spaces the parser doesn't need, and leaves names and logic alone.

// before
function add(a, b) {
    // sum two numbers
    return a + b;
}

// after
function add(a,b){return a+b;}

Use it for a quick size cut on a small script or a snippet you plan to inline in HTML. jsmin doesn't rename variables, drop dead code or tree-shake modules. For production bundles, a build tool such as esbuild, Terser or the minifier in Vite or webpack shrinks files further and generates source maps.

Beautify

The beautifier uses js-beautify with its default settings: 4-space indentation, one statement per line and braces on the same line. It helps you:

  • Read a minified third-party script while you debug it.
  • Tidy code copied from a console, a chat or a PDF.
  • Review a snippet before you paste it into your project.

Beautifying restores layout, not original names. If a build step renamed variables to a, b and c, the output keeps those names.

Things to know

  • Neither mode checks your code for errors. Broken input produces broken output, so run it through your linter or browser console if something looks off.
  • The tool sends your code to our server for processing. Don't paste API keys or other secrets.

Working with styles or data too? Try the CSS Minifier/Beautifier and the JSON Formatter.