How to create your own file extension ?

I have always wondered how can one create his own file extension ?

I am just curious and one day I want to make my own file extension.


Thank you



Last edited on
im no expert, but since no one else has answered this yet im just gonna try to give you an answer which is hopefully more correct than incorrect.

you see
there is no such thing as image files
or a video files or even text files.
all "files" are, is basically a bunch of 1s and 0s

if you were to open any file on your computer, right now, and you wanted to see the true content of it, you would see something like the following: 101011101000111000001111000...etc

so if all files contain the same thing (1s and 0s) then what makes them differ?
well, its the kind of encoding we use.
an encoding standard is basically just the way we store the 1s and 0s to represent: text, images, 3d files, etc.

PNG is a standard used to encode image data
TXT is another standard used to code, you guessed it, text
JPEG is another standard also used to encode image data (Just another way to do it)
and there are millions more
(you can literally go to google and search: PNG file format specifications, and you'll get all the details of how the 1s and 0s are stored to represent pixel data in PNG encoded files)

but just because a file ends with .png or .txt
doesn't mean that it has to be encoded in that way. you see these standards are just that. standards. nothing more.
just because there's a standard called png doesn't mean you have to follow it.
if you wanted, you could write an essay in notepad and then save it as "myessay.png"

Although, this might be a bad idea because sometimes programs like to "assume" how a file is encoded by using these extensions. so for instance, if you try to open a file called painting.png with paint, its most likely going to assume that its a PNG encoded file (although it doesn't have to, it just does since PNG is a very well know format).

so you see, file extensions really doesn't mean anything. they are basically just "hints" to programs (and users) so that they know how that particular file has been encoded and thus to decode them.
Sometimes (mostly in linux) you'll even see people not using file extensions at all.

So if you want to make your own file extensions you dont have to do anything special. You simply encode a file (this can be any kind of encoding. your own custom encoding, or even using existing standard encodings like txt) and then add your own cool extensions at the end of it.

for instance, you can write something in notepad, store it as myfile.txt and then simply by renaming it to myfile.myextension
you've created your very own extension. congrats.

If you want to learn how to make your own encoding standard then i would highly recommend learning about the internals of the computer first and figure out how everything actually works "under the hood" :)
Last edited on
Are you actually wondering about how to create a file association so Windows knows it's supposed to launch your application when a file with your extension is clicked on? If so, google "how to create a windows file association" for assorted advice.

For technical info see:

File Types and File Associations
https://msdn.microsoft.com/en-us/library/windows/desktop/cc144104(v=vs.85).aspx

To make sure you don't collide with an existing extension, see

List of file formats
https://en.wikipedia.org/wiki/List_of_file_formats

Andy
Last edited on
Topic archived. No new replies allowed.