Skip to content
YouNeed Tools
Free VPN

HTML and CSS Minifier

Choose CSS or HTML, paste your code or open a file, and copy or download the minified version. The size before and after is shown.

Code

194 → 145 bytes (25% smaller)

Minified on your device. Nothing you paste is sent anywhere.

Worked example

This CSS rule with a comment and loose spacing, .card { padding : 16px ; /* soft corners */ border-radius: 8px; } , becomes .card{padding:16px;border-radius:8px}: the comment, line breaks, spaces around the colon and the last semicolon are gone. The HTML list <ul> <li> One </li> <li> Two </li> </ul> becomes <ul><li> One </li><li> Two </li></ul>, keeping a single space inside each item.

What is removed and what is kept

RemovedKept
CSS commentsLicence comments starting /*!
Spaces around { } ; , > and after a property’s colonSpaces in selectors like “nav a”, in values and in calc()
The last ; before the closing braceText inside quotes and url()
HTML commentsOld IE conditional comments
Whitespace between block tagsOne space between words and inline tags
Runs of spaces and line breaks in textEverything inside <pre>, <textarea> and <script>

Minify, then compress

Minifying and server compression work together: minify first, then let the web server send the files with gzip or Brotli. Keep the original, readable files in your project and only publish the minified copies, since minified code is hard to edit. Most site builders and frameworks can do both automatically during a build; this tool is handy for one-off files, email templates and snippets pasted into a CMS.

When not to minify

Skip minifying during development, when readable code makes debugging easier, and for HTML that people will edit by hand later, such as a template in a content system. Email HTML is a special case: some email programs treat line breaks inside long lines differently, so test a minified email in the main clients before sending it to a list. If a page breaks after minifying, compare the before and after in the two boxes; with these safe rules the cause is usually invalid markup in the original, such as an unclosed tag.

Related tools

Sources

Checked on November 26, 2026:

Frequently asked questions

What does minifying do?
It removes characters the browser doesn’t need, such as comments, line breaks and extra spaces, so files download faster. The page looks and works the same.
Is this minifier safe?
It only makes changes that can’t alter how a page works: it keeps strings, url() values and licence comments (/*! … */) in CSS, leaves
,