Computer Literacy · Foundations
File Extensions
On this page 9 sections
In 30 seconds
A file extension The characters after the last dot in a filename that indicate the file's type, such as 'pdf' in report.pdf. Full entry → is the short suffix after the last dot in a filename The full name given to a file, which typically includes a base name and an extension joined by a dot. Full entry →, like the .pdf in report.pdf. It tells the operating system what type of file it is and which program to open it with. Common ones name documents (.docx, .txt, .csv), images (.jpg, .png), audio and video (.mp3, .mp4), archives (.zip), and programs (.exe). The extension is only a label, though, so it can be wrong or faked.
Why this matters
Extensions decide what happens when you double-click a file, so recognizing them saves time and prevents mistakes like sending a spreadsheet someone cannot open. In college you will submit assignments in required formats and convert between them, and naming a file correctly is part of doing that. The suffix is also a security signal: because operating systems often hide extensions, an attacker can disguise a program as a harmless document with a name like invoice.pdf.exe. Reading extensions, and turning on the setting that shows them, is a small habit that protects your files and your accounts.
The college version
What an extension is
A file extension is the sequence of characters after the final dot in a filename. In report.pdf the name is 'report' and the extension is 'pdf'; in budget.2025.xlsx only the last segment, 'xlsx', is the extension. Extensions are usually two to four characters, though longer ones exist. They are a naming convention, not part of the file's data: the bytes that make up a document do not change when you rename it. On Windows the extension is the primary way the system decides a file's type. On Linux and macOS the extension still matters for many applications, but those systems can also inspect the file's contents to guess its type, so the suffix is treated more as a hint. Because an extension is just text at the end of a name, anyone can change it, and changing it does not convert the file — renaming song.mp3 to song.txt does not turn the audio into text; it only mislabels it.
File association: how the OS uses the extension
The reason a double-click 'just works' is a mechanism called file association The operating system's mapping from an extension to the default program used to open files of that type. Full entry →. The operating system keeps a table that maps each registered extension to a default program The application the system launches automatically when you open a given file type. Full entry →. When you install software, its installer typically registers the extensions it handles — a word processor claims .docx, a media player claims .mp4. When you open a file, the system reads the extension, looks up the associated program, and launches it with that file. If no program is registered for the extension, the system asks you to choose one (the 'Open with' prompt). You can also change the default for an extension so that, say, all .csv files open in a spreadsheet program instead of a plain-text editor. This is why the same file can behave differently on two computers: the association, not the file, differs.
Common extensions by category
Learning a handful of families covers most everyday files. Documents and text: .txt (plain text), .docx (word-processor documents), .pdf (fixed-layout documents), .csv (comma-separated tabular data), and .pptx (slides). Images: .jpg/.jpeg (lossy, well suited to photographs), .png (lossless, supports transparency), .gif (limited to 256 colors, supports simple animation), and .svg (vector graphics that scale without blurring). Audio and video: .mp3 and .wav for sound, .mp4 and .mov for video. It helps to know that formats like .mp4 are containers — a wrapper that holds compressed audio and video streams (the codecs) together — so two .mp4 files can be encoded differently inside. Archives: .zip and .7z bundle and compress many files into one. Programs and scripts: .exe (a Windows program), .app (a macOS application), and script files such as .bat or .ps1. The program-and-script family is the one to treat with caution, because opening it runs code rather than displaying content.
The extension is a label, not a guarantee
An extension advertises what a file claims to be; it does not prove what the file is. The true nature of a file is in its bytes, and software that needs to be sure inspects those bytes rather than trusting the name. This is standard practice on the web: browsers decide how to handle a downloaded resource from the server's declared media type (the MIME type A standardized label like image/jpeg that declares a file's media type, used on the web instead of trusting the extension. Full entry →, such as image/jpeg), not from the URL's extension, precisely because the suffix 'may be absent, and there is no guarantee it is correct.' The practical lesson for you is symmetrical. A file with the right extension can still be corrupt or mislabeled, and a file can carry a misleading extension on purpose. Treat the extension as a strong hint that is usually right and occasionally, sometimes deliberately, wrong.
The security angle: hidden and double extensions
This is where the label becomes a safety issue. To look tidy, many systems — Windows by default — hide the extensions of known file types, so you see 'invoice' instead of 'invoice.pdf'. Attackers exploit that by giving a program two extensions: a file named invoice.pdf.exe is a runnable program (the real type is the last extension, .exe), but with hiding turned on it appears as invoice.pdf, complete with a document-style icon. A user double-clicks expecting a PDF and instead runs malware. Security references catalog this as a recognized masquerading technique, and documented malware campaigns have shipped files such as PreviewReport.DOC.exe and disguised .lnk shortcuts. Two defenses follow directly. First, turn on the setting that shows file extensions so the real suffix is always visible. Second, be wary of executable A file that contains a program the computer runs, rather than data it merely displays; on Windows commonly a .exe. Full entry → attachments (.exe, .scr, .lnk, .bat, and similar) arriving by email, and do not open one you were not expecting — the details of malware itself belong to a separate lesson, but the disguised-extension trick is the part that lives in a filename. When in doubt, verify with the sender through another channel before opening.

Eli explains
The same idea, in plain words
Explain it like I’m 10
Every file has a first name and a last name. The last name is the extension — the little tag after the dot, like .jpg or .docx. The computer reads that tag to decide which app should open the file, the same way a librarian reads a label to know which shelf a book goes on. Change the tag and you have only relabeled the file, not rebuilt it: renaming a photo to end in .txt does not turn the picture into words, it just puts on the wrong nametag. That is why the tag can lie. Some computers hide these tags to look neat, and sneaky people take advantage by giving a program two tags — the fake one you see and the real one that runs it.
Picture it like this
An extension is like the label on a jar in the pantry. The label says 'sugar,' so you reach for it when baking — that is the computer picking the right program. But a label is just a sticker: someone could put a 'sugar' label on a jar of salt. You only find out by looking inside, which is exactly why you should show the full label and be careful with jars a stranger handed you.
Where the picture stops working
The pantry label is separate from what is in the jar, and you can peek inside directly. A file extension is also separate text, but you cannot 'see inside' a file just by looking; you rely on the operating system, which mostly trusts the label. And unlike a jar, opening a mislabeled program file can immediately run it, so the cost of being fooled is higher than reaching for the wrong ingredient.
Worked example
You finish an essay and your professor requires a PDF. You choose 'Save As' and pick PDF, producing essay.pdf. Your teammate emails back essay.pdf.exe 'with my edits.' On your laptop, extensions are hidden, so it shows as essay.pdf with a document icon — but the real extension is .exe, meaning it is a program, not a document. You open your file settings and enable 'show file extensions.' Now the full name essay.pdf.exe is visible. Recognizing the double extension, you do not open it; you message your teammate, who confirms they never sent it. You then attach your own genuine essay.pdf, which opens correctly because .pdf is associated with your PDF reader.
Key takeaway
A file extension is the suffix after the last dot that tells the operating system a file's type and which program should open it, but it is a label, not a guarantee — show extensions and be cautious with executables so a disguised name like invoice.pdf.exe cannot fool you.
Quick check
3 questions here, of 5 in this lesson’s practice set. Answers stay hidden until you check.
When you double-click a file, how does the operating system decide which program to open it with?
You rename a photo from vacation.jpg to vacation.txt. What actually happens to the file?
Study tools & related lessonsYou’ll learn to · Common mistakes · Easily confused · Key vocabulary · Related
You’ll learn to
- Define a file extension and locate it within a filename.
- Explain how the operating system uses the extension for file association.
- Identify common extensions across documents, images, audio/video, archives, and programs.
- Distinguish an extension as a label from the file's actual contents.
- Analyze how hidden extensions and double extensions enable disguised malware, and apply safe habits.
Common mistakes
Believing that renaming a file's extension converts it to that format.
Renaming only changes the label. To truly convert, use 'Save As' or an export/convert feature that rewrites the file's contents.
Assuming a file is safe because it appears to end in .pdf or .jpg.
With extensions hidden, the visible suffix may not be the last one. Show extensions and check for a trailing executable type like .exe or .lnk.
Thinking the dots inside a name are all extensions.
Only the text after the final dot is the extension; budget.2025.xlsx has the extension xlsx, not 2025.xlsx.
Treating the extension as proof of the file's true contents.
The extension is a hint. Software that must be certain inspects the file's bytes or a declared type such as a MIME type.
Expecting every computer to open a file with the same program.
The program is set by each machine's file associations, which can differ; the file itself is unchanged.
Easily confused
File extension vs. File association
The extension is text in the filename that names the type; the association is the system's rule linking that type to a program.
Extension vs. MIME type
An extension is a filename suffix that may be wrong or missing; a MIME type is a declared media-type label (image/jpeg) that web software trusts instead of the suffix.
Renaming a file vs. Converting a file
Renaming changes only the extension text; converting rewrites the actual data into a new format.
invoice.pdf vs. invoice.pdf.exe
The first is a document; the second is a program whose real type is the final .exe, disguised by a fake .pdf when extensions are hidden.
Key vocabulary
- file extension
- The characters after the last dot in a filename that indicate the file's type, such as 'pdf' in report.pdf.
- filename
- The full name given to a file, which typically includes a base name and an extension joined by a dot.
- file association
- The operating system's mapping from an extension to the default program used to open files of that type.
- default program
- The application the system launches automatically when you open a given file type.
- executable
- A file that contains a program the computer runs, rather than data it merely displays; on Windows commonly a .exe.
- archive
- A single file, such as a .zip, that bundles and usually compresses many files together.
- MIME type
- A standardized label like image/jpeg that declares a file's media type, used on the web instead of trusting the extension.
- container format
- A file format such as .mp4 that wraps one or more compressed audio or video streams plus metadata into one file.
- double extension
- A filename with two extensions, such as invoice.pdf.exe, used to disguise a program as a harmless document.
Sources & references
- File Types and File Associations (Win32 apps) — Microsoft Learn
- Masquerading: Double File Extension (T1036.007) — MITRE ATT&CK
- MIME types (IANA media types) — MDN Web Docs (Mozilla)
- Image file type and format guide — MDN Web Docs (Mozilla)
- Media container formats (file types) — MDN Web Docs (Mozilla)
EliExplains lessons are original prose written from the open, credible references above. See Copyright & Licensing.
Researched 2026-08-19
Educational content only. It is not medical, legal or professional advice. Found an error? Tell us.

