File Extensions Explained: .pdf, .docx, .xlsx and More
The letters after the last dot in a file name tell your computer which program should open it. They are called file extensions. Knowing the common ones saves time and keeps you safer.
What an extension actually is
An extension is only a label. It does not change what is inside the file. Rename a photo from .jpg to .pdf and the content stays a photo, but now the wrong program will try to open it. The real format is determined by the file's internal structure.
Common extensions by type
| Type | Extensions | Typical program |
|---|---|---|
| Documents | .pdf, .docx, .rtf, .txt | Reader, word processor, text editor |
| Spreadsheets | .xlsx, .xls, .csv | Excel, Sheets, Calc |
| Images | .jpg, .png, .gif, .webp | Photo viewer, browser |
| Audio | .mp3, .wav, .flac | Music player |
| Video | .mp4, .mov, .webm | Video player, browser |
Why the extra letter in .docx and .xlsx?
Microsoft added an x to Office files in 2007 when it moved from binary formats (.doc, .xls, .ppt) to Office Open XML. The x means the file is a zipped bundle of XML. You can rename a .docx to .zip and look inside.
Extensions that deserve caution
- .exe, .msi, .bat, .cmd, .scr run programs.
- .docm, .xlsm, .pptm are Office files with macros.
- .js, .vbs, .ps1 are scripts.
- Double extensions such as invoice.pdf.exe try to look harmless. Turn on "Show file extensions" in your system settings.
What to do with an unknown file
- Check the full name and extension.
- Do not double-click it if you were not expecting it.
- Preview it in a sandboxed environment such as your browser, which does not run macros or programs.
- Scan it with your security software.