CSS Optimization: Make Your Sites Load Faster for Free

While a lot of people are out to optimize their sites/blogs, most everyone seems to skip over CSS.

I have been spending some time looking at CSS Optimization tools today. I wanted something free, online, and easy to use. And of course, something that worked. There are actually quite a few websites that fit the bill, and some of them are easier to use, produce more friendly code, and others are a bit harder to use, but can produce amazing results.

I tested the CSS Optimizer, Icey’s CSS Compressor, Flumpcakes CSS Optimiser, and CleanCSS to see which one could compress some default CSS files from popular websites the best.

I chose six sites:

  • Digg.com – poster boy of web 2.0, and a nice looking design to boot.
  • Slashdot – poster boy of ‘yesterday’. Moved into CSS relatively late, but still serving up a lot of pageviews.
  • Filmsy – a blog part of the BloggyNetwork, I think it has a very nice design
  • iBegin – nice local search engine I was using while in Toronto
  • Download.com – one of the most popular sites to go CSS
  • ESPN – a totally non-tech demographic, and also had a very publicized shift to CSS

CSS optimizers do a variety of voodoo magic to get the end result. This includes merging similar classes, removing useless properties, removing whitespace, and so forth. This can lead to code that is not very easily read by you or I, but for larger CSS files, it can condense the file size so much that it really makes a big difference in page loading times.

Many broadband users might not think this matters much, as most websites seem to load fast for them, but if each site you went to loaded even 10% faster, think of all the time it could save you over the course of a week, a month or even a year. The bandwidth savings for the website operator can also be immense. I would recommend that you always keep a copy of your human readable CSS code so that if you ever need to make any changes it does not take you a long time to figure out what you need to change, and then you can re-optimize it.

The Results
I ran all these tests with the tools being on their default settings.This might not have given them all equal footing, but I think it is how most of us will use them because we don’t know what options to turn on or off, and some tools did not have specialty options that could be turned on or off.

Digg was our first guinea pig. Before optimization Digg.com’s main CSS file was 30.56 KB.

Site After Reduction
CSS Optimizer 25.74 KB 9.89% (failed: moves Popular stories and upcoming stories tabs next to Technology header and messes up Digg Home button)
Icey CSS Compressor 16.69 KB 45.39% (failed: changes padding/margins on some items. Spaces things out more)
Flumpcakes CSS Optimiser 28.26 KB 5% (failed: Messes up Digg Home button)
CleanCSS 26.038 KB 16.8%

Slashdot recent redesign resulted in a CSS file of 19.1 kilobytes large. The CSS optimizers still delivered, shrinking the filesize quite a bit.

Site After Reduction
CSS Optimizer 15.01 KB 21.38%
Icey CSS Compressor 9.68 KB 49.38%
Flumpcakes CSS Optimiser 16.9 KB 11%
CleanCSS 15.234 KB 22.1%

Filmsy was next. This one had the smallest CSS file, clocking in at only 11.39 KB. Nevertheless, we achieved compression of almost 50%!

Site After Reduction
CSS Optimizer 9.25 KB 18.85%
Icey CSS Compressor 6.03 KB 47.08%
Flumpcakes CSS Optimiser 9.4 KB 17%
CleanCSS 8.27 KB 29.1%

Next up is iBegin Toronto. A nice search engine, its CSS file was 22.79 kb

Site After Reduction
CSS Optimizer 16.17 KB 29.04% (failed: font-size got larger)
Icey CSS Compressor 10.04 KB 55.95%
Flumpcakes CSS Optimiser 19.28 KB 12% (failed: font-size got larger)
CleanCSS 17.134 KB 26.6% (failed: font-size got larger)

Second to last came Download.com. The move to CSS-P made a lot of noise, and we thought it would be interesting to see what benefits a large company could get. The CSS file itself was a 54.2 kb, largest of all sites we tested.

Site After Reduction
CSS Optimizer 17.36 KB 32.39% (failed: Fonts and Padding on elements change)
Icey CSS Compressor 54.3 KB 0%
Flumpcakes CSS Optimiser 20.0 KB 17% (failed: Fonts and Padding on elements change)
CleanCSS 45.699 KB 17.8%

Last up came ESPN. Alongwith Download.com, these two sites are the most mentioned when it comes to the viability of CSS on large-scale websites. ESPN’s CSS clocked in at 25.68 kb.

Site After Reduction
CSS Optimizer 17.36 KB 32.39% (failed: Fonts and Padding on elements change)
Icey CSS Compressor 7.74 KB 69.84%
Flumpcakes CSS Optimiser 20.0 KB 17% (failed: Fonts and Padding on elements change)
CleanCSS 18.944 KB 27.9%

Condensed Table

Site CSS Optimiser Icey Compressor Flumpcakes Clean CSS
Digg.com failed failed failed 16.8%
Slashdot 17.45% 51.21% 9% 21.9%
Filmsy 18.85% 47.08% 17% 29.1%
iBegin failed 55.95% failed failed
Download.com failed 45.49% 0% 27.9%
ESPN failed 69.84% failed 27.9%
Average: 18.15% 53.91% 8.67% 24.18%

The clear winner here is Icey’s CSS Compressor, blowing away the rest. It even shows the compressed code with color coding, making it easier to see the changes they made and how its formatted. It also makes it easier to read that the output of most other tools.

In second place seems to be CleanCSS which is based on csstidy 1.1. It also shows syntax highlighting which makes it easy to understand. They also list the changes they made, and any errors they noticed.

In third comes CSS Optimizer which is one of the simplest of them all. It does not have the bells and whistles of the previous two, but is much nicer looking than our last place entrant, Flumpcakes CSS Optimiser.

Flumpcakes has a few more options than CSS Optimiser, but it does not have the same simple look. The results page in my personal opinion is ugly, and does not even tell the unit of measurement used for comparison.

Conclusions
CSS optimization is a very valid form of speeding up downloads without having to sacrifice much (just legibility). With the average dialup user downloading at 3kb/s, savings of just 10kb can mean the page loads a stunning 3 seconds faster. And just imagine ESPN with savings of almost 18kb. Multiple by the large traffic the site gets, and those are some real solid promotion-worthy savings. So while this may not be important whilst you use a broadband connection, just you wait until you go visit your grandparents.

Digg this Link

Categories: General

Comments

  1. son dakika haber says: 10/28/2008

    thanks

    Reply

  2. son dakika says: 11/17/2008

    bendende thanks efe mucu.

    I had some problems with my css. Thanks for the article!

    Reply

  3. 50plus says: 11/26/2008

    Thanks a lot for this nice article.

    Reply

  4. maggl says: 12/10/2008

    Not only interesting for beginners – good work. Thx!

    Reply

  5. Hannah says: 12/23/2008

    i normally use http://www.cssslick.co.uk (also very efficient)

    Reply

  6. Computer gebraucht says: 12/23/2008

    Very useful, thanks

    Reply

  7. Grafabrik says: 1/2/2009

    web tasarımı, web tasarım , İstanbul web tasarımı, web sitesi tasarımı, internet sitesi tasarımı, internet sayfası tasarımı, web sayfası, web sitesi, profesyonel web tasarımı

    Reply

  8. seo consultant says: 1/6/2009

    Its pretty good. It worked for me!! Thanks.

    Reply

  9. Onlineapotheke says: 1/9/2009

    Really good article. I’m not so kind with css, but your article helped a lot.

    Reply

  10. Dia says: 1/17/2009

    SOS! My auto was broken on ave. Must I call to repairs or 911?

    Reply

  11. Крутой says: 1/19/2009

    Спасибо!

    Reply

  12. mobil says: 1/19/2009

    thanks you:)

    Reply

  13. ttnet says: 1/19/2009

    Wir sind gefangen auf einem Planeten, den wir selbst angezündet haben. Fast acht Milliarden Menschen in Not. Der Fluchtweg ist uns versperrt. Zwischen uns und einem möglichen sicheren Hafen liegen die unendlichen und unüberbrückbaren Weiten des Universums. Wir haben also keine andere Wahl, als selbst das Feuer zu löschen.

    Reply

  14. Night says: 1/19/2009

    Good night, blobgers =)

    Reply

  15. Olina says: 1/20/2009

    Where I may to find posts on this topic?

    Reply

  16. Beddy says: 1/21/2009

    Yes, it’s true, I know!

    Reply

  17. Summer says: 1/22/2009

    Super! I’ll do similar post in my blog

    Reply

  18. sohbet says: 1/24/2009

    Thank

    Reply

  19. laura says: 1/26/2009

    Thanks! Icey’s CSS Compressor did the best, taking my file from 189kb to 89k. It’s a terribly huge file spit out by the ancient CMS system I’m forced to use at work… trust me, the CSS I write myself is never over 10kb, but this thing is a monster and I didn’t want to deal with cleaning it up.

    Reply

  20. Ferienhäuser says: 2/8/2009

    Its pretty good. It worked for me!! Thanks.

    Reply

  21. Ferienhäuser says: 2/8/2009

    hanks! Icey’s CSS Compressor did the best, taking my file from 189kb to 89k. It’s a terribly huge file spit out by the ancient CMS system I’m forced to use at work… trust me, the CSS I write myself is never over 10kb, but this thing is a monster and I didn’t want to deal with cleaning it up.

    Reply

  22. re-nature says: 2/25/2009

    People use CSS2 all the time, and they even already use parts of WHATWG HTML5 (like the CANVAS element, or contentEditable).
    I do not believe that the W3C HTML WG will complete recommendation status by 2008; and neither do I believe that that WG shall be disbanded late 2011.
    Specification are usable before being finished but not before those parts are incorporated into User Agents, e.g., browsers. Safari, Mozilla and Opera (since they’re the copyright holders) may be the first to include HTML5 elements and attributes once they become stable, Right?

    Reply

  23. Ferienhaus inserieren says: 4/4/2009

    Sehr schick.

    Reply

  24. K Irizawa says: 4/18/2009

    Didn’t thought of CSS optimization. Just read an article about Google crawling CSS pages, so this article was really relevant for me. Considering that some companies need to save some money on network it was nice to know optimizating CSS can help.

    Reply

  25. Ferienwohnung inserieren says: 4/22/2009

    We could start an app company that would launch on the iPhone, BlackBerry, facebook, myspace, linkeddin and put these clowns out of business.

    Reply

  26. Partnersuche says: 4/22/2009

    gefällt mir

    Reply

  27. Jacky says: 5/5/2009

    I got the same error message with all of them:

    We were unable to preview your template
    Please correct the error below, and submit your template again.
    Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly.
    XML error message: Content is not allowed in prolog.

    It is a BLogger Blog with widgets and stuff. Maybe someone can tell me how to make it load faster?

    Thanks!
    Jacky

    Reply

  28. iddaa says: 5/8/2009

    very interesting, thanks for your article

    Reply

  29. event dresden fcc says: 5/14/2009

    Very interesting article. greetings

    Reply

  30. V.C says: 5/29/2009

    I was wondering If you could show me the website to optimize HTML code.

    Reply

  31. sohbet says: 6/12/2009

    Thanks for the theme. I will just still have to get a different header image.

    Reply

  32. Daniela says: 6/15/2009

    good article. Super! I’ll do similar post in my blog

    Reply

  33. Daniela says: 6/15/2009

    good article. I’m not so kind with css, but your article helped a lot.

    Reply

  34. Versicherung says: 6/16/2009

    Thanks for this good ideas. Realy this is a great article. Versicherung im Vergleich

    Reply

  35. cep says: 6/21/2009

    thanx, ferfect so..

    Reply

Allowed HTML Tags:
B, I, U, A, EM, UL, OL

Comment Policy
Privacy Policy