Herramientas Guías
developer Gratis Sin registro

Minificador HTML / CSS / JS

Minifique HTML, CSS y JavaScript para reducir el tamaño del archivo — se ejecuta completamente en su navegador.

Cargando la herramienta…

Acerca de esta herramienta

Reduzca el tamaño de sus archivos HTML, CSS y JavaScript para cargas de página más rápidas. Cambie entre tres pestañas, pegue su código y vea la salida minificada al instante junto con el tamaño original, el tamaño minificado y la reducción porcentual. La minificación HTML elimina comentarios y reduce el espacio en blanco; CSS elimina comentarios y espacios en blanco; JS elimina comentarios de línea y de bloque y reduce el espacio en blanco.

Cómo usar

  1. 1 Seleccione la pestaña HTML, CSS o JS.
  2. 2 Pegue su código fuente en la entrada.
  3. 3 La salida minificada y la reducción de tamaño aparecen automáticamente.
  4. 4 Haga clic en 'Copiar salida' para copiar el código minificado.

Why minifying HTML, CSS, and JavaScript speeds up a page

Every byte your server sends has to travel the network and be parsed by the browser. Source code is written for humans — it is full of indentation, line breaks, blank lines, and explanatory comments that the browser does not need to do its job. Minification strips out everything that exists purely for readability, leaving functionally identical code that is smaller and downloads faster. On a high-traffic page, shaving even 20–30% off a stylesheet or script measurably improves load time, and smaller files compress better when the server applies gzip or Brotli on top.

This tool has three tabs — HTML, CSS, and JS — because each language has different rules about which characters are safe to remove. It shows the original size, the minified size, and the percentage reduction so you can see exactly what you saved.

What each mode removes

ModeRemoves
HTMLComments (except conditional [if] blocks), runs of whitespace, and spaces between tags
CSS/* comments */, extra whitespace, spaces around { } : ; , selectors, and the last semicolon before }
JSBlock /* */ and line // comments, blank lines, and collapsed whitespace

For HTML, the tool keeps conditional comments such as <!--[if IE]> intact because those are instructions to certain browsers, not human notes. For CSS, collapsing the space in color : red ; down to color:red is always safe. The JS minifier is a conservative whitespace-and-comment pass: it does not rename variables or restructure code, so it never changes behaviour.

A worked example

Paste this CSS into the CSS tab:

/* heading */
h1 {
  color: navy;
  margin: 0;
}

The minifier deletes the comment, collapses the indentation and newlines, removes the spaces around the braces and colons, and drops the final semicolon, producing h1{color:navy;margin:0}. The original is around 55 bytes; the output is about 25 — a reduction of more than half, reported live in the stats row.

Important limits to understand

This minifier works by pattern-matching whitespace and comments, which is fast and safe for well-formed, conventional code. It is not a full parser, so there are edge cases to respect:

  • JavaScript without semicolons. Because the JS pass collapses newlines into spaces, code that relies on automatic semicolon insertion across line breaks could change meaning. Use explicit semicolons, or run code through a parser-based minifier (like Terser) for production bundles.
  • Strings and regexes. A comment-like sequence inside a string (for example a URL containing //) is an edge case for any regex-based minifier. Review the output of code that embeds such patterns.
  • HTML whitespace that matters. Inside <pre>, <textarea>, or where you rely on a single space between inline elements, aggressive whitespace collapsing can shift layout. Check pages that depend on significant whitespace.

Best practices

  • Keep a readable source. Always minify a copy. Edit the formatted original and re-minify; never hand-edit minified output.
  • Minify, then compress. Minification and gzip/Brotli stack. Minified code compresses to an even smaller transfer size.
  • Measure with the stats. If a file barely shrinks, it was probably already minified — running it again wastes effort.
  • Test after minifying. Load the page or run the script once with the minified version before shipping it.

Use cases and privacy

Developers minify before deploying static assets, embedding inline styles in an email template, or pasting a snippet where size is constrained. It is handy for quick one-off files where setting up a full build pipeline is overkill. All three minifiers run entirely in your browser — your code is never uploaded to a server — so even proprietary markup or scripts stay on your own machine while you measure the savings.

Preguntas frecuentes

{# Alpine.js — self-hosted. (The previous jsdelivr CDN tag had a stale SRI integrity hash, so the browser refused to run it and window.Alpine was never defined — silently breaking every FAQ accordion and Alpine tool.) #}