Input
Output

About Code Minifier

This tool uses Prettier for formatting and simple whitespace removal for minification. All processing happens locally in your browser. Note: The minifier is a basic implementation and may not handle complex edge cases as well as build tools like Terser or CSSNano.

About Code Minifier (HTML, CSS, JS)

1What is it?

Instantly minify your JavaScript, CSS, and HTML code to reduce file size and improve website performance. This professional-grade minifier removes unnecessary whitespace, comments, and formatting to create the most compact code possible. All processing happens 100% in your browser, so your proprietary code never leaves your device.

2Use Cases

  • Prepare JavaScript and CSS bundles for production deployment
  • Reduce website bandwidth usage and server costs
  • Improve Core Web Vitals and page load speeds
  • Obfuscate code to discourage casual inspection
  • Optimize inline HTML/CSS for email templates
  • Compress JSON responses for API mocking

3Examples

Minify JS

Input

function hello() {
  // Say hello
  console.log('hi');
}

Output

function hello(){console.log('hi')}

?Frequently Asked Questions

Is it safe to minify my private code here?

Yes, completely safe. We use a client-side minification engine, meaning your code is processed entirely by your browser's JavaScript engine. It is never sent to our servers or any third party.

Will minification break my code?

Minification is designed to be safe, but it can break code if there are missing semicolons in JavaScript (ASI reliance) or invalid syntax. We recommend always testing the minified version before deploying to production.

How much space can I save?

Savings vary by code style, but typically you can expect 30-60% reduction in file size. Removing comments and long variable names (in advanced modes) facilitates significant compression.