It’s worth noting that the file extension is really just a part of the filename. The filename is just text, and by convention we consider the bit after the last period to be special.
But (aside from some OS-imposed restrictions) you can basically put whatever text you want in a filename. You can have files without extensions, files with made-up extensions, files with multiple extensions, etc. And renaming a file and changing the extension has no effect on the data itself.
It’s just that your OS has a list of extensions it knows and what it should do with files of that extension. When you try to open a file, the OS looks at the bit after the last period, says, “Do I know this type of file?” and if yes, it calls the appropriate program to open it. But that’s just something your OS does.
And yes, some types of files also have special data at the beginning that say what kind of data it is. This is why you can rename a jpg picture to png and most programs will still open it. Your OS recognizes that it’s an image file (even if you’ve named it the wrong type of image file) and calls a program that opens images. That program reads the data and recognizes the special data at the start that says, “Hey, I’m a jpg image” and so it opens the image correctly, ignoring the fact that you named it png.
Latest Answers