Lesson 2 of 51 · Module 1, lesson 2 of 6 · 5 min
Files, folders and file extensions
Make your computer show file extensions and create a folder for your website, on Windows or macOS.
What you'll learn
- What files, folders and file extensions are
- How to make your computer show file extensions (Windows and macOS)
- How to create a folder for your website, with names that will not cause problems
Why this matters
A website is a set of files inside folders. The browser finds your pages and pictures by their exact names and places. The most common problem for new web developers is a file with the wrong name — very often because the computer was hiding part of the name. Ten minutes here will save you hours later.
Files, folders and paths
- A file is one saved item: a photo, a document, a web page.
- A folder (also called a directory) is a container for files and for other folders.
- A path is the address of a file: the folders you open, one inside the other, to reach it. For example:
Documents › my-website › index.html.
File extensions
The file extension is the part of a file name after the last dot. It tells the computer what kind of file it is, and which program should open it.
| File name | Extension | Kind of file |
|---|---|---|
index.html | .html | Web page |
photo.jpg | .jpg | Photo |
notes.txt | .txt | Plain text |
report.docx | .docx | Word document |
A web page must end in .html. A file called index.html opens in a browser as a web page. A file called index.html.txt opens as plain text, even though the first part of the name looks right.
Here is the problem: Windows and macOS hide extensions when they are first set up. You may see index.html when the real name is index.html.txt. So your first job is to make your computer show the full name of every file.
Show file extensions on Windows
Windows 11
- Open File Explorer: click the folder icon on the taskbar, or press
Windows key + E. - At the top, click View.
- Point to Show.
- Click File name extensions, so that it has a tick.
Windows 10: open File Explorer, click the View tab at the top, and tick File name extensions.
Show file extensions on macOS
- Click an empty part of the desktop, so that Finder is the active program. Its name appears in the top-left corner of the screen, next to the Apple logo.
- In the menu bar at the top, click Finder, then Settings… (on older versions of macOS: Preferences…).
- Click Advanced.
- Tick Show all filename extensions.
Create a folder for your website
Keep all the files for one website together, in one folder. In this course that folder is called my-website, and it lives in your Documents folder.
Windows
- In File Explorer, click Documents on the left.
- Click New (Windows 11) or New folder on the Home tab (Windows 10). On Windows 11, choose Folder.
- Type
my-websiteand pressEnter.
macOS
- In Finder, click Documents in the sidebar on the left.
- Click File › New Folder, or press
Command + Shift + N. - Type
my-websiteand pressReturn.
Naming rules that save you trouble
Use these rules for every file and folder in a website:
- Lowercase letters only. Write
about.html, notAbout.html. Many web servers treatAbout.htmlandabout.htmlas two different files, so a link that works on your computer can break online. - No spaces. Use a hyphen instead:
my-website,contact-us.html. In a web address a space becomes%20, and that causes many broken links. - Only letters, numbers and hyphens — plus the dot before the extension.
What you'll see
A new, empty folder called my-website inside Documents. With extensions turned on, files you already had now show their endings, such as .jpg, .pdf or .docx.
Try it yourself
Open your Documents or Downloads folder and look at the files. Can you see their extensions now? Find three different extensions and say what kind of file each one is.
Common mistakes
- Skipping the "show extensions" step. Later, a file that you think is
index.htmlis reallyindex.html.txt, and it opens as text. How to spot it: the browser shows your code instead of a page. Fix: turn on extensions, then rename the file so that it ends in.htmlonly. - Spaces or capital letters in names, such as
My Website/Index.HTML. It may work on your computer and then break on a web server. Fix: rename everything to lowercase with hyphens now, while the project is small. - Saving files in different places. One file on the Desktop, another in Downloads. Your pages will not find each other. Fix: keep everything inside
my-website.
Check yourself
- What is the extension of
soup-recipe.html? - Why is
My Page.htmla poor name for a file in a website? - Where will you keep all the files for your first website?
Answers
.html- It has a capital letter and a space. Use
my-page.html. - In the
my-websitefolder, inside Documents.
Next: you have a folder. Now you need a program to write code in — a code editor.



