Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What do we mean by a "file format"?

share|improve this question

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.

Refer here too: – yasouser Jan 12 '11 at 14:02
I really don't see how could this not be a real question! – AndrejaKo Jan 12 '11 at 14:06

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.

share|improve this answer

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) :
2 3 000 000 000 000 000 000

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 :

  • Images : BMP, JPG, SVG, GIF, PNG
  • Text document : DOC, ODT, SXW
  • Sound : MP3, WAV, OGG
  • Video : webm, quicktime, h264, ogg/theora
share|improve this answer

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.

share|improve this answer

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.

share|improve this answer
"The" what? Is there a part missing? – AndrejaKo Jan 12 '11 at 14:35
He's asking what a file format is and you mention Java bytecode? That's like teaching differential equations to an elementary school class. – Daniel Beck Jan 12 '11 at 14:38
You never can tell, even with elementary questions. I've had people ask me how find "works" one minute, then dump data files in octal looking for an obscure error. – mfe Jan 12 '11 at 14:58
AndrejaKo - typo corrected. Thanks. – mfe Jan 12 '11 at 14:59

Not the answer you're looking for? Browse other questions tagged .