What do we mean by a "file format"?
closed as not a real question by ChrisF, harrymc, nhinkle♦, BinaryMisfit Jan 14 '11 at 7:51
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.
A file, any file, is just a collection of bytes. Nothing more.
To use those bytes, programs need to be able to understand what they mean, and so a file format is a specific way that the bytes are arranged and/or the data encoded such that programs that intend to interact with the file can understand it.
Many file formats have specifications that document how the files are encoded, allowing multiple programs to easily interact with and/or create files of this type.
But, anyone can create a new file format, I've done so myself on a few occastions for University programming assignments. By simply deciding how their data will be arranged in a single sequence of bytes such that their program can re-read the correct data at a later time.
Basically, it's the way you organize information in files. Files are just 1's and 0's grouped by 8 (bytes).
Let's take the example of file format for images. If you want to put an image in a file, how can you do that ? You can say that an image is several pixels and that all pixels has 3 values : red, green, blue (they are basic colors with which you can do all others). You also want to tell the size of the image before (ex: 5x10 ou 10x5).
So for an image of black 2x3 pixels, our basic file format is (each digit is a byte, I grouped by value) :
This is very basic, you could want to add : possibility to have transparent pixels, compression (e.g. 000 000 becomes 6 0), metadata like author name, work with shapes rather than pixels, etc. All these make modifications to the format of your file.
Every format has its own benefits depending on the usage.
Programs understand some formats and not others, and you can sometimes find converters from one to another.
Several examples of formats :
What is a language? Any animal can make sounds. What makes our sounds different than dogs? What makes it understandable? What makes English different than Chinese?
The translation, agree'd upon definition of words, grammar, etc. Different languages have different rules. Different dialects of the same language have different rules (American English vs British English vs Ghetto Street English)
File format is the same... it's what turns Zeros and Ones into A's and B's, an executable, a picture or music.
How does an MP3 go from data to sound? File format describes how to treat the data and what the desired outcome is.
It's a way to identify file contents that are appropriate to one kind of consumer. There are two popular ways of doing it: a) an extension to the file name; and/or b) by a code, aka magic number, at the file's beginning.
Some consumers, like Windows Explorer, rely on file extensions.
Other consumers, like the Unix file(1) command, use the first two bytes of a file to determine its intended use.
Some consumers require both. The Java virtual machine checks for the code 0xCAFEBABE to verify a file contains Java bytecode. It also insists on a .class (or .cla) extension. The XML does this too, to ensure consistency across platforms that inherently prefer one approach over the other.