As of now, there are some available extensions: for example Minify or JS & CSS Minifier

Note: You can find extensions on the VS Code Marketplace.

Or directly from VS Code by searching from the Extensions pane, on the left side (Ctrl + Shift + X).

Answer from Supersharp on Stack Overflow
🌐
Visual Studio Marketplace
marketplace.visualstudio.com β€Ί items
Minify - Visual Studio Marketplace
Extension for Visual Studio Code - Minify for VS Code. Minify with command, and (optionally) re-minify on save.
🌐
Visual Studio Marketplace
marketplace.visualstudio.com β€Ί items
MinifyAll - Visual Studio Marketplace
Extension for Visual Studio Code - Minifier for JSON, CSS, HTML, XML, TWIG, LESS, SASS, SCSS, JavaScript, JSONC, and JavaScriptReact(testing). Compressor of files and folders. You will love its simplicity!
🌐
GitHub
github.com β€Ί CaffeineOnIce β€Ί AutoMinify
GitHub - CaffeineOnIce/AutoMinify: A VSCode extension to minify HTML, CSS and JS files. Β· GitHub
Automatically minify your HTML, CSS, and JS files to optimize space and bandwidth usage.
Starred by 3 users
Forked by 2 users
Languages Β  JavaScript
🌐
GitHub
github.com β€Ί Josee9988 β€Ί MinifyAll
GitHub - Josee9988/MinifyAll: A 𝗩𝗦𝗖𝗼𝗱𝗲 𝗺𝗢𝗻𝗢𝗳𝗢𝗲𝗿 for JS, JSON/C, CSS, and HTML, you will love its simplicity! 🌟 π˜Ύπ™€π™’π™₯π™§π™šπ™¨π™¨ and π™œπ™―π™žπ™₯ files and folders πŸ“¦ Reduce your bundle and file sizes with lightning speed ⚑
A 𝗩𝗦𝗖𝗼𝗱𝗲 𝗺𝗢𝗻𝗢𝗳𝗢𝗲𝗿 for JS, JSON/C, CSS, and HTML, you will love its simplicity! 🌟 π˜Ύπ™€π™’π™₯π™§π™šπ™¨π™¨ and π™œπ™―π™žπ™₯ files and folders πŸ“¦ Reduce your bundle and file sizes with lightning speed ⚑ - Josee9988/MinifyAll
Starred by 77 users
Forked by 15 users
Languages Β  TypeScript 90.8% | Shell 6.2% | JavaScript 3.0%
🌐
DEV Community
dev.to β€Ί aryaziai β€Ί minifying-code-shortcut-4d6c
Minify Code Automatically - DEV Community
April 12, 2021 - Modify the extension settings: ☐ Minify On Save β˜‘ Minify On Save To New File ☐ Open Minified Document -min Prefix on new minified file Note: You may also disable specific file extensions (i.e. HTML files)
🌐
GitHub
github.com β€Ί miguelcolmenares β€Ί css-js-minifier
GitHub - miguelcolmenares/css-js-minifier: The CSS & JS Minifier extension for Visual Studio Code allows you to minify CSS and JavaScript files directly from the editor. Using the minification service provided by Toptal, this extension makes it quick and easy to optimize your files.
The CSS & JS Minifier extension for Visual Studio Code allows you to minify CSS and JavaScript files directly from the editor. Using the minification service provided by Toptal, this extension makes it quick and easy to optimize your files.
Author Β  miguelcolmenares
🌐
Visual Studio Marketplace
marketplace.visualstudio.com β€Ί items
JS & CSS Minifier (Minify) - Visual Studio Marketplace
Extension for Visual Studio Code - Easily Minify ES5/ES6/ES7/ES8 and CSS. Supports minify on save, minify selection & custom configurations!
Find elsewhere
🌐
Visual Studio Marketplace
marketplace.visualstudio.com β€Ί items
Auto-Minify - Visual Studio Marketplace
Extension for Visual Studio Code - Automatically minify your HTML, CSS, and JS files on save
🌐
Reddit
reddit.com β€Ί r/vscode β€Ί is there an extension to minify a selection? not an entire file, just what i have selected.
r/vscode on Reddit: Is there an extension to minify a selection? Not an entire file, just what I have selected.
September 26, 2019 - My use case is coding and editing HTML emails. If I style an element in chrome inspector, then copy and paste it into an editor, it's not inline and I have to do it manually or use something like https://www.willpeavy.com/tools/minifier/ which isn't very efficient. ... I've not been able to find anything like this. How sophisticated would you want it to be? I've made a few VSCode ...
🌐
GitHub
github.com β€Ί HookyQR β€Ί VSCodeMinify
GitHub - HookyQR/VSCodeMinify: Add minify function to VSCode 0.10+
Minify your js, css and html files to save transmit bandwidth. Calls each of the minifiers directly, allowing settings to be passed:
Starred by 55 users
Forked by 23 users
Languages Β  JavaScript 100.0% | JavaScript 100.0%
🌐
Sir Node
sirnode.com β€Ί blog β€Ί 12-great-visual-studio-code-plugins-for-web-developers
12 Great Visual Studio Code Plugins for Web Developers - Sirnode
Thanks to ES5 / ES6 and CSS Minifier , you can minify your CSS and JavaScript files effortlessly . After installing this plugin in Visual Studio Code, a small "Minify" button will appear in the status bar at the bottom of the editor .
🌐
YouTube
youtube.com β€Ί watch
How to Compress & Minify HTML,CSS & JS Files For Production in VS Code Using Minify Extension - YouTube
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.
Published Β  October 6, 2024
🌐
GitHub
github.com β€Ί microsoft β€Ί vscode β€Ί issues β€Ί 75194
Minifying feature to expand to cover the html Β· Issue #75194 Β· microsoft/vscode
I was searching to find an extension that can minify the file itself, regardless of the extension of the files, and I found HTML-Minifier, but unfortunately it doesn't cover the case when the page includes <script> that's written in ECMA 6, so it minifies the .php files (that includes css styles and htmls) but neglects the javascript parts.
🌐
GitHub
github.com β€Ί olback β€Ί es6-css-minify
GitHub - olback/es6-css-minify: Easily minify CSS and JavaScript in VS Code
Easily minify CSS and JavaScript in VS Code. Contribute to olback/es6-css-minify development by creating an account on GitHub.
Starred by 48 users
Forked by 13 users
Languages Β  TypeScript 91.8% | JavaScript 6.9% | CSS 1.3% | TypeScript 91.8% | JavaScript 6.9% | CSS 1.3%
🌐
GeeksforGeeks
geeksforgeeks.org β€Ί html β€Ί how-to-improve-performance-by-minify-compress-files
How to Improve Performance by Minify & Compress Files ? - GeeksforGeeks
July 23, 2025 - It reduces the project size and improves performance. How does minification work? The developers write the HTML, CSS, and JavaScript first because while developing the code needs to be well-readable and understandable.
🌐
Visual Studio Marketplace
marketplace.visualstudio.com β€Ί items
Minify HTML in PHP - Visual Studio Marketplace
Extension for Visual Studio Code - Minify HTML in PHP is a Visual Studio Code extension designed to automatically optimize HTML files and HTML code embedded within PHP files. This efficient tool removes unused spaces, tabs, and comments, effectively ...