UtilitySansar
Développeurs

JavaScript Minifier

Compact JavaScript by stripping comments and collapsing safe whitespace — with strings, template literals, and regex literals preserved exactly. Runs in your browser, no upload.

Résumé de l'outil

Cet outil accepte une entrée structurée et renvoie une sortie déterministe dans le navigateur, sans envoi au serveur.

Nom de l'outil
JavaScript Minifier
Intention d'entrée
Fournissez le contenu source à transformer, valider ou analyser.
Intention de sortie
Recevez une sortie normalisée prête à être copiée, réutilisée ou déboguée.
Entrée d'exemple
// say hi function hi(name) { return `Hello, ${name}!`; }
Sortie d'exemple
function hi(name){return `Hello, ${name}!`;}
Original242 B
Minified163 B
Saved79 B
Reduction32.6%
Strings, template literals, and regex are preserved exactly. No identifiers are renamed.

Introduction à l'outil

Compact JavaScript by stripping comments and collapsing safe whitespace — with strings, template literals, and regex literals preserved exactly. Runs in your browser, no upload.

Vue d'ensemble de l'outil

This is a lightweight, conservative JavaScript minifier. It walks your source one token at a time, leaving every string, template literal, and regular expression untouched while removing line and block comments and shrinking runs of whitespace where it is safe to do so. It does not rename identifiers, shorten property accesses, or perform tree-shaking — for that you want a full bundler. What it does well is compressing snippets, examples, inline scripts, and configuration code without changing their behavior.

Cas d'usage

  • Inline a small snippet into HTML where every byte matters.
  • Quickly minify a code sample for a documentation page or blog post.
  • Pre-process configuration scripts before piping them into a CMS field.

Exemples d'entrée/sortie

Intention d'entrée
// say hi
function hi(name) {
  return `Hello, ${name}!`;
}
Intention de sortie
function hi(name){return `Hello, ${name}!`;}

Questions fréquentes

Does it rename variables (mangle)?+
No. This is a whitespace-and-comments minifier only. For mangling, dead code elimination, and bundling, use a tool like esbuild, terser, or swc.
Will it break template literals or regex?+
No. The tokenizer recognizes ', ", `, /…/ and template ${} interpolation, and never modifies their contents.
Is automatic semicolon insertion (ASI) handled?+
The minifier preserves newlines that matter for ASI by inserting a single space rather than gluing tokens together where it cannot safely do so.

Explorer plus d'outils

Découvrez des utilitaires liés dans la catégorie Développeurs ci-dessous.

Parcourir tous les Développeurs

Outils liés

Utilitaires sélectionnés à la main qui pourraient vous être utiles