Removing spaces is only one part of JavaScript minification. The JavaScript Minifier uses Terser with compression and name mangling enabled. It parses source text and returns a transformed version, so the most useful review asks whether the result still behaves correctly in the environment where it will run.
Submit JavaScript rather than a page wrapper
Paste the code into Source code and choose Minify code. Omit HTML script tags and Markdown fences. The input limit is 250,000 UTF-8 bytes. The tool lazy-loads Terser, then reports Input bytes and Output bytes and offers the generated code as minified.js.
Keep a readable original in your project. This interface does not offer source maps, a reserved-name list, module options, or a complete build configuration. A production project with those requirements may need minification in its existing build pipeline instead of an isolated manual transformation.
Understand a constant-folding example
Enter console.log(2 + 3);. With this implementation’s options, the output is console.log(5);. Terser has replaced the constant arithmetic expression with its value and removed spaces. The tool has not executed the console.log call and does not display a program output of 5; the result is still JavaScript source.
Larger examples may also show renamed local variables and rearranged expressions. The exact text can depend on the source and parser version, so do not make a workflow depend on one particular short variable name. Byte counts compare the text before and after minification, not compressed network transfer sizes.
Test where the code belongs
A successful parse does not establish that DOM elements exist, imported dependencies are available, or external APIs behave as expected. Run the reviewed output through the same application checks as any other code change. Exercise functions that depend on names being visible to other scripts or on unusual runtime behavior, since isolated minification cannot inspect the whole project.
If the parser reports a syntax error, return to the readable source and check its language and expected environment. This tool does not transpile TypeScript, bundle modules, supply browser compatibility shims, or prove that a program is safe. Generated code should never be pasted into an unfamiliar execution context just because minification succeeded.
Processing occurs in the browser, and the submitted program is not run by the tool. Avoid including secrets in code you intend to publish. Use the HTML Minifier for the enclosing markup when appropriate; use the JSON Formatter for data documents, since JSON validation and JavaScript minification solve different problems.