We improve and update our CSS compression tool weekly to achieve the highest possible results. The current version is 1.05.
Although the main goal is reducing file size, this leads to a chain reaction of positive effects.
CSS (Cascading Style Sheets) is the language responsible for the appearance of a web page. If HTML is the site's "skeleton" (structure), then CSS is its (colors, fonts, margins, element layout).
When we developers write CSS code, we strive for readability. We use:
The result is a file that is easy to read and maintain. For example:
This code is understandable to a human. But for a browser, 90% of this code is "garbage".
Minification is the process of removing all unnecessary characters from source code (in this case, CSS) without changing its functionality.
A CSS minifier is a tool (program, script, or web service) that automatically performs this process.
It takes our readable "source" CSS file and it eliminates the superfluous, creating a new, much smaller file that will be used on the "live" site.
Let's see what a minifier does to our code example above:
What exactly happened?
{, }, :, ; are unnecessary. Only those separating values (e.g., 24px and bold) are kept. ;) removed from the last rules: The semicolon after the last property in a block (color: #333333;) is not mandatory. #FFFFFF (6 characters) turned into #fff (3 characters). #CCCCCC turned into #ccc.#333333 turned into #333.font-weight: bold was replaced with font-weight: 700 (in some minifiers, as 700 is shorter). 0.5em, it would turn into .5em. As a result, the file size can decrease by 20-70%. When your project grows to thousands of lines of CSS, this saving becomes colossal.
Modern minifiers, like our CSS Minifier online, go even further. They don't just remove characters; they structurally rewrite CSS for maximum efficiency.
Before:
After:
Before:
After:
Before:
After:
Before:
After:
1. In the first field, paste or type in your CSS code that you want to compress.
2. A "Compress CSS" button will appear below; click it.
3. If your CSS code is correct, the second field will contain the ready-to-use code for your applications.
4. Two methods will be available for you to copy the ready-to-use code:
The first, and most convenient, method is by clicking the additional button labeled "Copy Compressed CSS". Your code will then be copied to the clipboard, allowing you to easily paste it where needed.
The second method is suitable for those who need partial copying: you can simply select the desired fragment from the second field and copy it in the standard way.
5. Copying Safety.
We have taken care to protect the ready-to-use code from accidental changes during copying, so you no longer need to worry about this.
6. What do the errors mean?
Typically, error messages appear when the tool detects incorrect CSS code. It specifies the line where the error was found and provides a description of the error itself, which greatly facilitates the correction of your code.
We use it to improve the "CSS Minifier and Compressor" tool.