An extension (also called a file type or format) is the few characters after the dot at the end of a file name. It lets the programs on your computer recognise what to do when you open the file. In other words, the extension tells in advance what is inside.
The most common extensions
Here are some of the best-known file formats:
- .pdf - Portable Document Format
- .doc / .docx - a document format. The name comes from document, and the "x" from the standard behind it (Office Open XML)
- .csv - plain-text data separated by commas (comma-separated values). It is a handy way to move tables between programs, for example into a spreadsheet
- .xls / .xlsx - a spreadsheet file, e.g. Microsoft Excel
- .jpg / .jpeg - an image; the name comes from the group behind the compression method that makes it take less space on disk (Joint Photographic Experts Group)
- .png - an image as well (Portable Network Graphics)
- .mp3 - sound; the name comes from the version of the audio compression method (MPEG-1/MPEG-2 Audio Layer 3)
- .txt - a plain-text file, simple but used for everything (it defines no data structures or complex standards). It can hold many kinds of data (program code or a website script, for example), but most of them have their own extension, like ".php", ".html", ".ini" or ".md", to say exactly what is inside. You could just as well create a file called "article.bwrite" and open it in a text editor, because it would still be a text file.
A few extensions you will meet more and more often:
- .webp and .avif - newer image formats. At the same quality they are usually much smaller than .jpg or .png, which is why more and more websites (this blog too) use them
- .json - a text data format that applications and servers use to talk to each other. You can read it in any text editor
- .md - Markdown, plain text with simple marks such as # for a heading. Documentation is written in it, and AI chats like to answer in it too
- .zip - an archive, many files packed into one, usually compressed as well
Hidden extensions and the "invoice.pdf.exe" trap
Windows hides the extensions of known file types by default. It looks tidier, but it has a dark side. A file called "invoice.pdf.exe" shows up in the folder as "invoice.pdf" - and it is not a document but a program that starts when you double-click it. It is one of the oldest tricks in virus emails.
That is why it is worth switching extensions on (in File Explorer: View, then "File name extensions"). From then on you see what you are really opening. If an attachment from a "courier" ends in .exe, .scr, .bat or .js, better leave it closed.
Does changing the extension change the file?
No. The extension is just part of the name, a hint for the system. Rename "photo.png" to "photo.jpg" and there is still a PNG image inside - some programs will open it anyway, others will report an error. To really change the format, the file has to be converted, that is saved again in another format. Images can be converted, for example, with the image converter, which works in your browser without uploading the files anywhere.