5 Easy Ways to Speed Up your Website

It's always important to have a website that loads quickly. Most users will not wait for more than a few seconds for the page to load. Just one second too long could mean that your users will go to a competitor's site. Here are some quick and easy ways to speed up your website.

1. Compress your JavaScript and CSS

Once you've finished making changes to your JavaScript and CSS, make a separate copy to upload, and go through it and remove all unnecessary whitespace (line breaks, spaces and tabs) and comments. Also, when you can, shorten your hex colour values. For example, #FF0000 can be shortened to #F00. This will help to reduce the file size.

Example of CSS compression

There are some online tools that will even do this for you, such as CSS Drive CSS Compressor, and the Javascript Compressor.

2. Place your scripts at the bottom

Leave as many scripts as you can at the bottom of the page so that your content can load first. If the scripts are on top, they will have to finish loading before anything below it can.

3. Compress your web graphics

If you use Photoshop, use the "save for web" option when saving your images. If you use another image editing software, if you can, save your image at the highest compression level that doesn't show visible compression artifacts.

4. Keep CSS and JavaScript in external files

When your CSS and JavaScript is kept in external files, they can be cached by the browser, making every page using those files load faster.

To link a css file:

<link rel="stylesheet" type="text/css" href="style.css" media="screen" />

To link a JavaScript file

<script type="text/javascript" src="script.js"></script>

5. Don't use HTML to scale images

Sure, it may seem easier to just use a larger and set the width and height of your image to smaller values than the actual size of the image, but the entire, larger image will be sent to the browser. Plus, the image will also need to be scaled down by the browser, which will take even more time.

Do you have any other tips on how to speed up your website?

Stay Updated

Did you enjoy this post? Don't miss a single post by getting free updates!

7 Comments

  1. Justin D.
    July 23, 2009

    Nice tips. Thanks!

  2. Thanks for posting about this, I would love to read more about this topic.

  3. July 27, 2009

    Enabling gZip compression will give your website a boost up in it's loading speed.

    I too have posted something related to this one in my blog at http://tech.inkapoint.com/website-development/8-easy-steps-slow-website-blogs/892/

  4. July 28, 2009

    Useful tips. Thanks for sharing Eric. I need to cut down my CSS a bit I think.

  5. January 14, 2010

    This is a great list to get started on speeding up your site. There are many more things that you can do as well.

    Once tactic that I have found particularly effective is to parallelize downloads across hostnames. Instead of linking to blah.com/images/image.jpg - you should have it link to images.blah.com/image.jpg. Most browsers can only handle 2 simultaneous downloads on a per domain basis.

    • January 14, 2010

      Interesting idea. I'll have to try that out sometime, and test for differences in speed.

Trackbacks/Pingbacks