How can I minify CSS manually?

Abhishek padhi
2 min readFeb 18, 2023

--

Minifying CSS manually can be done by following these general steps:

  1. Remove all unnecessary white space: Remove all line breaks, tabs, and multiple spaces that are not necessary for the structure of the CSS.
  2. Remove comments: Comments can be helpful for future reference, but they are not necessary for the browser to read the CSS so that they can be safely removed.
  3. Shorten color codes: If you have color codes in your CSS, you can shorten them. For example, #ffffff can be shortened to #fff.
  4. Shorten font names: You can also shorten font names. For example, instead of writing “Arial, Helvetica, sans-serif”, you can write “Arial, sans-serif”.
  5. Combine selectors: If you have multiple selectors that share the same properties, you can combine them into a single rule. For example:
h1, h2, h3 {
font-weight: bold;
color: #333;
}

can be written as:

h1, h2, h3 { font-weight: bold; color: #333; }

6. Minify property names: You can shorten property names as well. For example, instead of writing “background-color”, you can write “background”.

7. Use shorthand properties: Shorthand properties can save space in your CSS. For example, instead of writing:

padding-top: 10px;
padding-right: 20px;
padding-bottom: 30px;
padding-left: 40px;

you can write:

padding: 10px 20px 30px 40px;

These steps will help you manually minify your CSS. However, keep in mind that there are also automated tools available online that can help you minify your CSS more quickly and accurately.

CSS Minify Tool

If you don’t want to do these steps manually then you can use an Online CSS Minify Tool That will do the job for you. Just paste the CSS code and it will automatically minify the codes for you.

--

--

Abhishek padhi
Abhishek padhi

Written by Abhishek padhi

I am a professional Blogger & content writer. I Mostly write about Blogging and SEO tips. You can find me On key2Blogging.com

No responses yet