Code & Media

JS / CSS / HTML Minifier

Minify or format JavaScript, CSS, and HTML, and see the size difference.

  • Draft kept in this tabYour draft is kept in this tab's session storage and cleared when the tab closes.
  • Runs in your browserProcessing happens in this page. No application server receives your input.
Load sample

Source code input

Transformed source output

Transform summary

Language
JS
Mode
minify
Original size
0 B
Output size
0 B
Byte delta
0 B
Used original
no
Execution
Worker (codegen)

What this tool does

Minifies or formats JavaScript, CSS, and HTML locally in a background Web Worker, reports the UTF-8 byte delta, and returns the original source when the minified output is not smaller.

Minification & formatting rules

  • Valid source in minify mode when output is smaller: returns the minified source and a negative UTF-8 byteDelta.
  • Valid source in minify mode when output is not smaller: preserves the original source unchanged with usedOriginal: true and byteDelta: 0 (FR-CODE-4).
  • Valid source in format mode: formats JavaScript, CSS, or HTML with consistent indentation and spacing.
  • Leading shebang (#!) lines in JavaScript files are preserved across both minification and formatting.
  • Unrecognized language values return the input unchanged without throwing (FR-FMT-4).
  • Syntax errors return ParseFailed naming the 1-based line and column and never emit partial output.
  • Empty or whitespace-only input is the neutral cleared state and produces empty output with no error (GAP-013).

Operational limits & execution

Maximum input size: 4.0 MB of UTF-8 source text (returns InputTooLarge above cap). Source maps are not produced. Execution is routed to codegen.worker.ts with cooperative cancellation.

Worked example

Input:

const a = 1;
console.log( a );

Expected output:

const a=1;console.log(a);

Scope: this covers the page itself. Your browser, operating system, clipboard, downloads, extensions, and crash recovery may keep copies, and a compromised site origin would not be protected.