Every file on a computer is just a sequence of bytes, but different files arrange those bytes in completely different ways. A file containing a photo and a file containing a spreadsheet are both stored as 0s and 1s — but the pattern of those bits follows a specific format that tells software how to interpret them.
File Extensions
A file extension is the short suffix after the dot in a filename. It signals to the operating system and to the user what format the file is in:
report.docx— a Word documentholiday.jpg— a JPEG imagesong.mp3— an MP3 audio file
The extension is not technically part of the data; it is a label. You could rename song.mp3 to song.txt, but the data inside does not change — it would still be audio data, and a text editor would show garbled nonsense.
Some operating systems hide file extensions by default. This is a security risk: malicious files can be named document.pdf.exe and appear to be a harmless PDF. Always configure your system to show extensions.
Common File Types by Category
Text Files
| Extension | Format | Description |
|---|---|---|
.txt | Plain text | Simple text, no formatting, universally readable |
.docx | Word document | Rich text with formatting, images, tables |
.pdf | Fixed-layout document, looks the same everywhere | |
.csv | Comma-separated values | Table data as plain text, one row per line |
.html | HTML | Web page markup |
Image Files
| Extension | Format | Description |
|---|---|---|
.jpg / .jpeg | JPEG | Compressed photos — lossy compression |
.png | PNG | Lossless compression — good for diagrams and screenshots |
.gif | GIF | Limited to 256 colours; supports animation |
.svg | SVG | Vector graphics — scales to any size without pixelation |
.bmp | Bitmap | Uncompressed images — large file sizes |
Audio Files
| Extension | Format | Description |
|---|---|---|
.mp3 | MP3 | Compressed audio — lossy |
.wav | WAV | Uncompressed audio — large but high quality |
.flac | FLAC | Lossless compressed audio |
.aac | AAC | Compressed audio used by Apple and streaming services |
Video Files
| Extension | Format | Description |
|---|---|---|
.mp4 | MPEG-4 | Common compressed video format |
.avi | AVI | Older Microsoft container format |
.mov | QuickTime Movie | Apple video format |
Data and Code Files
| Extension | Format | Description |
|---|---|---|
.csv | CSV | Data tables (rows and columns) |
.json | JSON | Structured data used widely in web applications |
.py | Python source | Python programming language source code |
.zip | ZIP | Compressed archive containing multiple files |
A container format (like .mp4) is a wrapper that holds multiple types of data — for example, video, audio, and subtitles — inside a single file, each encoded in their own format.
Proprietary vs Open Formats
Some file formats are controlled by a single company (proprietary): .docx belongs to Microsoft, .psd to Adobe. Others are open standards that anyone can use and implement freely, like .png, .csv, and .svg.
Open formats are generally safer for long-term storage because they do not depend on a single company's software remaining available.
For sharing documents that must look identical on every device, use PDF. For data that will be imported into different programs, use CSV. For images on websites, use JPEG for photos and PNG for graphics with sharp edges or transparency.
Practice Problems
A student saves a photo as a .bmp file and another as a .jpg file at the same resolution. Which will have a larger file size, and why?
Show answer
Why is CSV a good choice for storing tabular data that needs to be used in different programs?