Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>Auto Minify Web FilesNew to Visual Studio Code? Get it now.
Auto Minify Web Files

Auto Minify Web Files

Algosentinel

| (0) | Free
Minify CSS, JavaScript, HTML, JSON, SVG, and XML — on save, from Explorer, or for whole folders. Creates sibling .min files locally.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Auto Minify Web Files

Minify CSS, JavaScript, HTML, JSON, SVG, and XML in Visual Studio Code.

Creates a sibling minified file next to each source (for example app.js → app.min.js). Processing is 100% local — nothing is uploaded.

Features

  • Minify the current file (Command Palette or editor context menu)
  • Minify a file or whole folder from the Explorer
  • Minify the entire workspace
  • Optional minify on save
  • Skips already-minified files (*.min.js, etc.)
  • Safe writes: temp file + replace; never overwrites the source by default
  • Configurable exclusions, concurrency, and max file size
  • Status bar toggle for minify-on-save
  • Output channel: Auto Minify Web Files

Quick start

  1. Install the extension from the Marketplace.
  2. Open a supported file (for example styles.css).
  3. Run Auto Minify: Minify Current File from the Command Palette (Ctrl+Shift+P / Cmd+Shift+P).
  4. A sibling file is created: styles.min.css.

To minify automatically when you save:

  • Click the status bar item Auto Minify: Off → On, or
  • Set autoMinifyWebFiles.minifyOnSave to true in Settings.

Supported file types

Type Extensions Engine
JavaScript .js, .mjs, .cjs Terser
CSS .css Clean CSS
HTML .html, .htm html-minifier-terser
JSON .json Native JSON.parse / JSON.stringify
SVG .svg SVGO (conservative)
XML .xml fast-xml-parser

Output naming

assets/css/style.css     →  assets/css/style.min.css
assets/js/app.js         →  assets/js/app.min.js
vendor.bundle.js         →  vendor.bundle.min.js
theme.dark.css           →  theme.dark.min.css
index.html               →  index.min.html
config.json              →  config.min.json

Already minified files are detected case-insensitively and skipped so you never get app.min.min.js.

Commands

Command Description
Auto Minify: Minify Current File Minify the active editor document
Auto Minify: Minify File Explorer context menu on a supported file
Auto Minify: Minify Folder Recursively minify supported files in a folder
Auto Minify: Minify Workspace Process all workspace folders
Auto Minify: Toggle Auto Minify on Save Turn on-save minification on or off

Settings

Open Settings and search for Auto Minify.

Setting Default Description
autoMinifyWebFiles.enabled true Master switch
autoMinifyWebFiles.minifyOnSave false Minify on save
autoMinifyWebFiles.exclude (sensible defaults) Glob patterns to skip
autoMinifyWebFiles.include [] Force-include patterns (override exclude)
autoMinifyWebFiles.outputSuffix .min Suffix before the extension
autoMinifyWebFiles.showNotifications true Success toasts for manual commands
autoMinifyWebFiles.preserveComments license all | license | none
autoMinifyWebFiles.minifyInlineJavaScript false Minify inline JS in HTML
autoMinifyWebFiles.minifyInlineCss false Minify inline CSS in HTML
autoMinifyWebFiles.folderConcurrency 4 Parallel files for folder/workspace
autoMinifyWebFiles.maxFileSizeMB 10 Skip larger sources

Default exclusions

node_modules, .git, dist, build, .next, vendor, coverage/cache folders, and *.min.* files are excluded by default. Customize with autoMinifyWebFiles.exclude.

Privacy and security

  • All minification runs locally in the VS Code extension host.
  • No analytics, telemetry, or remote upload of file contents.
  • Source files are never executed (eval / shell minification are not used).
  • Workspace content is treated as untrusted input.
  • Destination paths are validated (same directory only; no path traversal).

Known limitations

  • JSON with comments (JSONC) is not supported.
  • Inline HTML JS/CSS minification is off by default (safer).
  • SVG/XML minification prioritizes correctness over maximum size reduction.
  • Source maps are not generated in this version.

Troubleshooting

  1. Open View → Output and select Auto Minify Web Files.
  2. Confirm the extension is enabled: autoMinifyWebFiles.enabled.
  3. Confirm the file type is supported and not already *.min.*.
  4. Check exclude patterns if folder minify skips expected files.

License

MIT — see the LICENSE file in the extension package.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft