How can I speed up my website?

There are many factors that affect the loading speed of a website, and even if you have the fastest hosting possible if your site is not properly optimized, it may be for nothing as the visitors own internet and computer speed will become the limiting factor, so it is important to optimize your site so your visitors always get the best possible experience.

Below are a few simple things you can do to help improve your website's performance.

Optimize your images.

Images are typically the single largest files in a website and take the longest to load for a visitor, always optimize your images especially JPG images which if left unoptimized can be much larger than needed. A JPG image can be compressed significantly without perceivable loss of quality, usually, a level of about 80% is good and the resulting image can be as little as 10% of the original size even with smaller images. Here is an example.

Unoptimized JPG at 100% quality [62KB]

Optimized JPG at 80% quality [9KB]

That saved 53KB for one small image with no perceivable loss in quality and so imagine how much you could save by optimizing all the jpg's in your site or a large 800x250 pixel banner image.

One other bad habit many get into is to use HTML to resize an image in the page which is common when showing thumbnail images of larger images. Resizing in HTML does not resize the actual image, it simply changes the visible dimensions in the page. So your browser is still downloading the full-size image and also doing a much worse job of visually sizing the image. Where possible the HTML size (width and height values of the IMG tag) should match the actual image dimensions which means it is better to have a smaller thumbnail-sized image to use instead which links to the full-size image.

Looking ahead to the future there are new image formats like googles WepP or JPEG 2000 which have even better compression and more features than other formats but as of nov/2020 they are not fully supported by many older browsers still in common use but certainly look out for them when it comes to getting the most out of your website loading time.

Compress and cache code

Most servers will allow you to compress your HTML/CSS/JS etc code for transmission on the fly and if you are using lots of large CSS or js files which is common with many CMS based websites or those that use jquery a lot, then code compression can be as important as image compression. You can easily enable code compression for common text files. also setting expiry levels for common file extensions that do not update regularly can speed up subsequent page loads of your website for visitors.

On Linux:  add the following to the bottom of your public_html/.htaccess file (Create one if you don't have one)

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType application/ "access plus 1 year"
ExpiresByType font/ttf "access plus 1 year"
ExpiresByType font/otf "access plus 1 year"
ExpiresByType font/woff "access plus 1 year"
ExpiresByType font/woff2 "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"
ExpiresByType image/x-icon "access 1 year"
ExpiresByType application/pdf "access 1 month"
ExpiresByType application/javascript "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresDefault "access 1 month"
# BEGIN Cache-Control Headers
<ifModule mod_headers.c>
<filesMatch "\.(ico|jpe?g|png|gif|swf)$">
Header set Cache-Control "public"
<filesMatch "\.(css)$">
Header set Cache-Control "public"
<filesMatch "\.(js)$">
Header set Cache-Control "private"
<filesMatch "\.(x?html?|php)$">
Header set Cache-Control "private, must-revalidate"
# END Cache-Control Headers
#Disable Etags
<IfModule mod_headers.c>
   Header unset Etag
   Header set Connection keep-alive
FileETag None

On Windows:  add or amend the following to your wwwroot/web.config file within the <system.webServer> node

<add extension=".js" policy="CacheUntilChange" kernelCachePolicy="DontCache" />
<add extension=".css" policy="CacheUntilChange" kernelCachePolicy="DontCache" />
<add extension=".ttf" policy="CacheUntilChange" kernelCachePolicy="DontCache" />
<add extension=".otf" policy="CacheUntilChange" kernelCachePolicy="DontCache" />
<add extension=".htm" policy="CacheUntilChange" kernelCachePolicy="DontCache" />
<add extension=".html" policy="CacheUntilChange" kernelCachePolicy="DontCache" />
<add extension=".woff" policy="CacheUntilChange" kernelCachePolicy="DontCache" />
<add extension=".woff2" policy="CacheUntilChange" kernelCachePolicy="DontCache" />
<add extension=".png" policy="CacheUntilChange" kernelCachePolicy="DontCache" />
<add extension=".jpg" policy="CacheUntilChange" kernelCachePolicy="DontCache" />
<add extension=".jpeg" policy="CacheUntilChange" kernelCachePolicy="DontCache" />
<add extension=".gif" policy="CacheUntilChange" kernelCachePolicy="DontCache" />

Enable website caching

One of the other big things that slow down a website is dynamic pages. These are pages that have content loaded from a database, so if you are using a CMS like WordPress or Joomla which are notoriously high resource users it is vitally important that you enable some form of page caching technology.

Joomla comes with its own cache system, just enable it from the global settings. For WordPress, some caching plugins we have had good results with are WP-Optimize and LiteSpeed Cache, if you are using some other CMS then check with the coder. In most cases caching simply creates static HTML versions of your dynamic pages to be served instead so the server does not have to always go to the database for the page content, these are updated whenever your content is changed.

Last word

Don't forget by optimizing your websites you can decrease your page load times, making your site much faster and keeping your visitors really happy, it is also a metric used by search engines to decide ranking so is really important. One other benefit is you can also reduce your bandwidth usage considerably saving you money and so it is well worth spending a little time getting great results.

All of this sound like too much hard work then why not request a quote from us to do it all for you. We have been optimising websites since 2005, from back in the days when average internet speeds were considerably less and having an optimised website was even more important so we know what we are doing. Visit our UK Web Design page to request a quote.

  • 10 Users Found This Useful
Was this answer helpful?

Related Articles

How to associate a domain to web space

Normally it is best to assign the name servers of your host to your domain name, in this way all...

What is an email "alias" and what is it for? (Windows Hosting)

What is an email alias and what is it for? (Windows Hosting) An email alias is an alternative...

Website Development Project Phases

When having your website created it is easier to split the process into a few well-defined...

Setting read and write permissions on files and folders (Windows)

On our Windows hosting file/folder read and write permissions are set by using the file manager...

What website factors influence search engine position

There are many factors that influence a website's position in SERPs (Search Engine Results...