A file is a container your computer uses to store information in one place
A file is a collection of data — text, images, video, code, or anything else — that your computer treats as a single unit and saves with a name. When you write a document in Microsoft Word, take a photo on your phone, download a song, or save an email, you are creating or storing a file. Your computer keeps track of where that file lives on the hard drive, what it contains, and what program should open it.
Every file has two parts: a filename and a file extension. The filename is what you choose — "Budget 2024" or "Vacation Photos". The extension is a short code after a dot that tells your computer what kind of file it is. A file named "Budget 2024.xlsx" has the extension .xlsx, which means it is an Excel spreadsheet. A file named "Photo.jpg" has the extension .jpg, which means it is an image. Your computer uses the extension to decide which program to open the file with.
Key Takeaways
- A file is a named container that holds one piece of information — a document, image, video, or any other data — and lives somewhere on your computer's storage.
- The file extension (the letters after the dot in the filename) tells your computer what type of file it is and which program should open it.
- Files are organized into folders, which work like drawers in a filing cabinet, and folders can contain other folders to keep things organized.
- When you save a file, your computer writes it to the hard drive and remembers its location so you can find it later by name or by browsing through folders.
How your computer finds and stores files
Your computer stores files on a hard drive (or solid-state drive on newer machines), which is like a massive filing cabinet. When you save a file, your computer writes the data to the drive and creates a record of where it put that data. The next time you want to open that file, you can search for it by name, or you can browse through folders to find it.
Files live inside folders (also called directories), which work like drawers in a filing cabinet. A folder can hold files, and it can also hold other folders inside it. For example, you might have a folder called "Documents" that contains a folder called "Taxes", which contains a file called "2023 Return.pdf". This structure lets you organize thousands of files so you can find what you need without scrolling through a flat list.
When you open a file, your computer reads the data from the hard drive and loads it into the program that knows how to display it. If you double-click a file named "Letter.docx", your computer sees the .docx extension, knows that Microsoft Word handles that format, and opens Word with the file loaded inside it. If you double-click "Photo.jpg", your computer opens an image viewer instead.
Common file types and what they do
Different file extensions represent different kinds of data, and each one is designed for a specific purpose. Here are the types you will encounter most often:
| Extension | File Type | What It Contains |
|---|---|---|
| .txt | Plain text | Text with no formatting — no bold, italics, or colors |
| .docx | Word document | Formatted text, images, and tables created in Microsoft Word |
| Portable Document Format | A document that looks the same on any computer or device | |
| .xlsx | Excel spreadsheet | Data organized in rows and columns, often with calculations |
| .jpg or .png | Image | A photograph or graphic |
| .mp3 or .wav | Audio | Sound or music |
| .mp4 or .mov | Video | Moving images with sound |
| .zip | Compressed archive | Multiple files bundled together and compressed to save space |
When you receive a file from someone else, the extension tells you what program you need to open it. If someone sends you a .docx file and you do not have Microsoft Word, you can open it in Google Docs or another word processor that reads that format. If someone sends you a .pdf, you can open it in almost any browser or PDF reader.
Why file extensions matter
The extension is not just a label — it is instructions for your computer. If you rename a file from "Photo.jpg" to "Photo.txt", your computer will try to open it as text, and you will see gibberish instead of an image. The data inside has not changed, but your computer no longer knows how to interpret it.
This is why you should not change a file's extension unless you know what you are doing. If you need to convert a file from one format to another — for example, from .docx to .pdf — use a program designed to do that conversion, not just a rename. The program will rewrite the file in the new format so it actually works.
On Windows computers, file extensions are often hidden by default. You can turn them on in File Explorer by going to View and checking "File name extensions". On Mac computers, extensions are usually visible. Seeing the extension helps you understand what a file is before you open it, which is especially useful when you receive files from the internet.
Files versus programs
A program (or application) is software that does something — it edits photos, plays music, browses the internet, or writes documents. A file is the data that the program works with. Microsoft Word is a program; "Letter.docx" is a file. Photoshop is a program; "Vacation.jpg" is a file. When you open a file, you are asking a program to read and display it.
Programs are also stored as files on your computer, but they are special files that your computer recognizes as executable — meaning they can run and do things. When you install software, you are copying program files to your computer and telling your operating system where to find them. When you click an icon to launch the program, your computer finds those files and runs them.
What happens when you delete a file
When you delete a file, your computer does not immediately erase the data from the hard drive. Instead, it removes the record of where that file is located and marks that space as available to be overwritten. The data sits there until your computer needs the space for something else. This is why deleted files can sometimes be recovered with special software — the data is still there, just hidden.
When you empty the Recycle Bin (on Windows) or Trash (on Mac), you are telling your computer that you are done with those files and it can overwrite them whenever it needs to. If you want to make sure a file cannot be recovered, you need to use a secure deletion tool that overwrites the space multiple times with random data. For everyday use, emptying the Recycle Bin or Trash is enough.
File size and storage space
Every file takes up space on your hard drive, measured in bytes. A simple text file might be a few kilobytes (KB). A photo might be a few megabytes (MB). A video can be hundreds of megabytes or several gigabytes (GB). Your computer has a total amount of storage space, and when you save files, you are using up that space.
If your computer is running low on storage, you can free up space by deleting files you no longer need, moving files to an external hard drive, or uploading them to cloud storage like Google Drive or OneDrive. You can check how much space you have left by opening File Explorer (Windows) or Finder (Mac) and looking at the storage indicator. If you are consistently running low on space, consider moving large files like videos or photo libraries to external storage.
Frequently Asked Questions
What is the difference between a file and a folder?
A file holds data — text, images, video, or anything else. A folder is a container that holds files and other folders. Think of a file as a piece of paper and a folder as an envelope or drawer. You can put multiple files in one folder, and you can put folders inside other folders to organize them.
Can I change a file's extension to convert it to a different format?
No. Changing the extension does not convert the file; it just tells your computer to try opening it with a different program, which usually fails. To convert a file from one format to another, use a program designed for that conversion. For example, use Microsoft Word to save a .docx file as a .pdf, or use an image editor to save a .jpg as a .png.
Why do some files have two extensions, like "document.tar.gz"?
Some files are compressed or bundled multiple times. A .tar.gz file is a collection of files that has been bundled into a .tar archive and then compressed with gzip. You need to decompress it in the right order to get to the original files. Most modern computers can handle this automatically, but you may need a tool like 7-Zip or The Unarchiver.
What happens if I open a file with the wrong program?
Your computer will try to interpret the data using that program's rules, and you will usually see gibberish or an error message. For example, if you open a .jpg image file with Notepad, you will see random characters instead of a picture. This does not damage the file — you can close the program and open it with the correct one.
Can a file have no extension?
Yes, but it is uncommon on Windows. On Mac and Linux, files often have no extension. Without an extension, your computer has to guess what program should open the file, which usually fails. If you encounter a file with no extension, you can try right-clicking it and selecting "Open with" to choose a program manually.