Cheat sheet #1

File and folder naming for the web

A cheat sheet for web design students. If you follow these conventions, your files will work on every server and behave in every browser, and they’ll make sense to the next person who opens your project.

The short version

Use lowercase letters, numbers and hyphens, and nothing else.

about-us.html   team-photo-2026.jpg   main-styles.css
On this cheat sheet

The rules

1. Use lowercase only

Most web servers run Linux, which treats Logo.png and logo.png as two different files. Your own computer may forgive the difference, but the live server won’t, and the result will be a broken image.

Docontact-form.html
Don’tContact-Form.HTML

2. Never use spaces

Browsers convert each space in an address to %20, so a name with spaces looks messy in the address bar, and it can easily break links. Replace every space with a hyphen.

Dosummer-sale-banner.jpg
Don’tsummer sale banner.jpg

3. Separate words with hyphens

This style is known as kebab-case. Search engines read a hyphen as a word break, so web-design-tips is understood as three separate words. Underscores, on the other hand, join words together, so you should avoid them in any name that the public will see in a URL. Bottom line, pick one separator and use it everywhere in the project.

Doweb-design-tips.html
Don’tweb_design_tips.html
webDesignTips.html
WebDesignTips.html

4. Stick to letters, numbers and hyphens

Special characters already have jobs to do in URLs and file systems. For example, a # starts a page anchor, a ? starts a query string, and a / separates folders. That’s why you should leave them out of your names.

Dofaq-and-help.html
price-list-2026.pdf
Don’tFAQ&Help!.html
price list (new) #2.pdf
cost£$€.pdf

5. Use plain English letters (no accents)

Accented and non-Latin characters can be saved differently on different systems, so they may turn up as garbled symbols. It’s safer to use the plain letter instead.

Docafe-menu.html
Don’tcafé-menü.html

6. Keep names short but meaningful

A good name tells you what’s inside the file without you having to open it, so aim for two to four words. Long names are hard to type and hard to read, and that makes them easy to get wrong.

Dohero-mountains.jpg
Don’tIMG_0042.jpg
image1.jpg
photo-of-the-mountains-we-visited-last-summer-on-holiday.jpg

7. Always include a lowercase file extension

Use the standard extension for the file type, and use the same one every time. For example, choose .html rather than .htm, and .jpg rather than .jpeg. If you stay consistent, your links will never point to the wrong version of a file.

File typeUseAvoid
Web page.html.htm, .HTML
Stylesheet.css.CSS
JavaScript.js.JS
Photo.jpg.jpeg, .JPG
Graphic with transparency.png, .webp, .svg.PNG

8. Call your home page index.html

When someone visits a folder, the server looks for a file called index.html and displays it. So, your home page must be named exactly that, and it must sit in the top folder. The same applies to any subfolder that should open without a file name in the address.

Do/index.html
/blog/index.html
Don’t/home.html
/Index.html
/blog/blog-home.html

9. Don’t start names with a dot, hyphen or underscore

A leading dot hides a file on Mac and Linux systems, and a leading hyphen can be mistaken for a command option. To avoid both problems, always start a name with a letter or a number.

Domain-styles.css
Don’t.main-styles.css
-main-styles.css
_main-styles.css

10. Use numbers carefully

Add a leading zero to numbers so that your files sort in the right order: 01, 02, 10, rather than 1, 10, 2. In the same way, write dates as year-month-day so that they sort by date.

Do01-intro.html
02-layout.html
2026-10-08-launch-news.html
Don’t1-intro.html
10-wrapup.html
8-10-2026-launch-news.html

11. Describe the content, add a size only if you need one

An image name should describe what the picture shows. If you keep several sizes of the same image, add the width to the end of the name. Note that describing the picture in its file name is a different job from writing its alt text, which you still need to add in the HTML.

Doteam-photo-london.jpg
team-photo-london-400.jpg
logo-white.svg
Don’tDSC_8831.jpg
photo-final-small.jpg
new-logo-2-copy.svg

12. Don’t put “final” or “new” in a name

Names like page-final-v2-REAL.html stop meaning anything within a week. Instead, keep one current file, and use version control such as Git, or a dated backup folder, to keep track of older versions.

Doservices.html
Don’tservices-final.html
services-new2.html
services-copy.html

13. Use the same rules for folders

Folders follow all the rules above, so use lowercase, no spaces, and hyphens between words. Keep to short, standard names, and try not to nest folders more than three or four levels deep.

Doimages/
css/
js/
case-studies/
Don’tMy Images/
CSS Files/
Javascript_Stuff/
New Folder (2)/

14. Be consistent

The best convention is the one that the whole project follows. Choose a pattern, such as topic-detail-size, and use it for every file. If you join an existing project, copy the pattern that’s already in use.

15. Rename before you publish, not after

Once a page is online, other websites, search engines and your own pages will link to it by name, so renaming it will break all those links. If you really must rename a file, update every link to match, and set up a redirect.

A well-named project

Quick reference

ConventionRuleExample
Letter caselowercase onlygallery.html
Word separatorhyphenphoto-gallery.html
Spacesneverphoto gallery.html
Special charactersnevergallery&news!.html
Accentsavoidgalerie-été.html
Extensionlowercase, standard.html .jpg .css
Home pageindex.html/index.html
Numbered orderleading zeros01-intro.html
Datesyear-month-day2026-10-08-news.html
Length2 to 4 wordshero-mountains.jpg

Check before you upload

Learn more

Tip: if an image works on your computer but not on the live site, the first thing to check is the case of the file name.