snaptxt.app

HTML, CSS & JS Minifier

Minify HTML, CSS, and JavaScript online — strip comments, collapse whitespace, and reduce file size. Runs entirely in your browser.

HTML
Minified output

How to use it

  1. 1Pick a language tab — HTML, CSS, or JavaScript.
  2. 2Paste your code into the input textarea, or click Load sample to see an example.
  3. 3The minified output appears immediately below with a stats bar showing original size, minified size, and percentage reduction.
  4. 4Click Copy next to the output to send it to your clipboard, ready to drop into a build artifact or a CDN.

Common use cases

  • Minify an HTML page before deploying a static site to reduce initial payload.
  • Shrink a CSS file before deploying a static site that doesn't use a bundler.
  • Minify a small JavaScript utility snippet to paste into a CMS custom-code field.
  • Strip comments from a stylesheet or HTML file before sharing it externally — comments often contain internal notes.
  • Quickly estimate how much an HTML, CSS, or JS file would shrink before wiring up a full build pipeline.

Frequently asked questions

Is this production-grade minification?
It covers the most impactful steps — comment removal and whitespace collapse — which typically yield 30–60% reduction on real files. It does not perform advanced optimizations like dead-code elimination, property shorthand merging, or variable inlining. For production, use a dedicated tool like html-minifier, cssnano, esbuild, or Terser in your build pipeline.
Will HTML minification break inline scripts or styles?
The HTML minifier collapses whitespace globally — including inside <script> and <style> blocks. For HTML files with complex inline JS or CSS, run those sections through the JS or CSS tab separately and recombine.
Will it break my CSS selectors or string literals?
CSS minification uses a simple regex pass that collapses whitespace around punctuation — it doesn't parse the full CSS grammar. For standard stylesheets this is safe. Very unusual selectors or data URIs with embedded spaces could theoretically be affected, so always test the minified output.
Does JS minification rename variables?
No. This tool removes comments and collapses whitespace — it doesn't mangle variable or function names. For full mangling, use esbuild, Terser, or Google Closure Compiler in a build step.
Is my code uploaded anywhere?
No. Minification runs entirely in your browser using JavaScript regex replacements. Nothing is sent to a server — safe for proprietary stylesheets, scripts, and HTML templates.