How to write a friendly filename

Lewis Wake
Thursday 22 September 2022

Naming a file is the first step of saving one.

It is often the same as the title of the document, a description of a photograph or image, or similar.

A filename that contains capital letters, special characters or spaces is quite common and is fine if you just want to open your file from your desktop. But they are unsuitable on the internet.

URL encoding

URL encoding converts characters into a format that can be transmitted over the internet.

URLs can only be sent over the Internet using the ASCII character-set.

Since URLs often contain characters outside the ASCII set, the URL has to be converted into a valid ASCII format.

URL encoding replaces unsafe ASCII characters with a “%” followed by two hexadecimal digits.

URLs cannot contain spaces. URL encoding normally replaces a space with %20.

The bad example

If I were to upload a PDF document with the filename University of St Andrews.pdf to the University website, the URL for the document would be https://www.st-andrews.ac.uk/media/University%20of%St%20Andrews.pdf.

This is not great for humans to read.

Solution

If you are preparing a document to be uploaded to the internet, you can give it a very simple, web-friendly, filename.

Avoid using any special characters, capital letters or spaces.

The good example

So if you have a file that’s called University of St Andrews.pdf that you want to upload to the web, create a copy and name it university-of-st-andrews.pdf.

The URL will be outputted as https://www.st-andrews.ac.uk/media/university-of-st-andrews.pdf

Much easier for humans to read, and share!


You can find further guidelines for naming files on the filename standards webpage of the University website.

Related topics