Beginner's Guide

5 Ways to Improve Your Website's Speed

By Matthew Beck

Websites should be fast. This is the internet after all, built for quick transfer of information and in today's world nobody has time to wait.

There are a thousand reasons your website might be running slow and a thousand ways to improve things. Let's run through some of the worst culprits that are also easy and quick to fix.

#1 - Compress Your Images!

Showing wasted data transfer in a HD Image
A full sized web picture over a camera's raw photo.

The single biggest cause of slow websites are images. Not that the images themselves are a problem but rather their resolutions and file sizes.

But what's the difference?

Simply put, the resolution is the number of pixels the image contains. The file size is the amount of space needed to store the image. Higher file sizes mean more downloading and slower web pages.

In most cases the smaller the resolution the smaller the file size.

Except there's a small catch - small resolution images can be big too.

So how do we resolve this?

Start by reducing the resolution of your images. Websites don't need to have images beyond certain dimensions, screen sizes only get so big. Aim for 1920 x 1080 - the HD resolution. At those dimensions, your image will be big enough to cover the largest of screens.

Then further optimise your resized images. If you're using Wordpress then that's just a case of installing a plugin like Ewww. If not, you can use offline tools like Riot. Don't want to download anything? Try the great online tool Kracken.

For a good visualisation of the data transfer wastage check the image above. The full image is your raw camera image, at a huge resolution. The smaller version is at HD resolution, as big as you'll need. By making your visitors load the full image you're introducing a 3765 x 3765 pixel wastage - 6 times more than you need!

#2 - Reduce Your Files

many files lead to slow websites
Each extra file adds to the workload.

Websites are made up of a collection of files that need to be sent over to your visitors. Every single one needs to be sent separately - there's no bundling them up once it's time to send them over.

That means that every single file needs to initiate a connection, wait for a response, be transmitted, be completed and then read by the browser.

If you have an older server then bad news - one file needs to be completed before the next one can start (more on that later!).

If you have a more modern server then better news - files can be sent all at once. But you're not out of the woods yet, some files will block others from downloading until they've been sent over.

So what's the fix?

Reduce the number of files you're sending. There's no way around it, fewer files means faster websites.

Do you really need all of those Javascript and CSS files? Combine each types into one. How about those 50 images - can some be loaded a little later when someone starts flicking through your gallery?

3 Speaking Of Javascript - Cut Down On Your Libraries

Loading too many javascript libraries will slow your page
Loading too many Javascript libraries will slow your page.

Javascript - the web's language of functionality and interactivity.

You might have filled your website with great features, all done for you by loading a Javascript library each time.

But there hit a point very quickly where things started to slow down - probably about the time you installed your fourth library.

Why did this happen?

Each Javascript library is a separate file (unless you combined them - good job!). But it goes further than that, Javascript is a client side language.

I hope I didn't lose you there. But it's important to know that the code runs on your visitors browsers and must be read and understood every time they visit your page.

Javascript itself just instructs the browser how to behave in certain situations, leading to all of the features you added in.

The problem with libraries is that they contain far more than you'll ever need. You're loading 12 libraries when all you needed was a single book.

Remove all of the libraries you don't need. You can do without hit counting widgets and page scroll smoothers. If you have the know-how or the budget for someone who does then ask them to recreate some of the features your libraries provide. You'll be surprised how little code things need sometimes, cut your book down into a single page.

#4 Base Your Server In The Right Country

Choose The Right Country For Your Website
Choose the right country for your website.

The speed of light is fast. But not that fast. The biggest limitation to transferring a website's information across the world is the speed of light - it just takes too long to go around.

While it is true that light can go around the world seven times per second, data doesn't have the luxury of travelling in a vaccum.

Right. But what does that mean for me?

Each additional mile between your server and your visitor will introduce a slightly larger delay. A full world round trip will add at least 1.5 seconds, if not closer to 3 seconds.

This means that you need to choose carefully where you place your website's server. For many businesses that's easy, just place it in the country you operate in. For others it's not so easy - what to do if you deal with customers all over the world?

The solution is to use a content delivery network, or CDN. They will syndicate your website to servers all over the world and transmit the data from the closest one to your visitor, ensuring a fast connection no matter where they're from.

Two great options are Stackpath (formally MaxCDN) and Cloudflare.

#5 Use A Faster Server

Your server can make or break your website's speed
Your server can make or break your website's speed.

All of the good work you put in by following the above tips can easily be ruined by your choice of server.

There are two types of server setup, shared or dedicated.

Shared servers put your website on the same machine as thousands of other websites, if any of them experience a spike in visitors, your website will suffer. While it's the right choice if you have a limited budget, look to upgrade if your site gets more popular or if you make any money through your website.

Dedicated servers host only your website and allow better customisation - but come at a heavier price tag.

There are many server systems that can handle your website, the most widely used being: Apache, Nginx and IIS (Microsoft).

Most shared servers use Apache, it's easy to manage due to its folder level settings configs - .htaccess files. Only this isn't good for website speed, these configs need to be read and understood every time a visitor loads your page.

IIS is Microsoft's server system. It's hard to recommend mostly because it underperforms vs other systems and requires a Microsoft operating system, instead of the server king, Linux.

Nginx is my recommended system, it's fast and works great on dedicated servers. The configs are set in stone once the server is booted up, no wasted time checking for modifications.

Be wary of shared hosts and opt for nginx if at all possible.

I'm Matthew Beck, web designer, developer and owner of Lightspeed Digital. I create bespoke websites from scratch, working with any industry. To find out what I can do for you, call 01273 421702 or send me message at: lightspeed-digital.com/contact