Code Minifier

Minify HTML, CSS, and JS

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

1What is it?

Minify JavaScript, CSS, and HTML code to reduce file size and improve load times. Remove unnecessary whitespace, comments, and formatting without breaking functionality. Essential for web performance optimization.

2Use Cases

  • Prepare code for production deployment
  • Reduce website bandwidth usage
  • Improve page load speed
  • Obfuscate code slightly (side effect)

3Examples

Minify JS

Input

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

Output

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

?Frequently Asked Questions

Is minification safe?

Yes, minification only removes characters that are not required for the code to execute (like whitespace and comments). It does not change the logic of your code.