What Is a File Format

A file format is the agreed way the data inside a file is arranged, so that a program knows how to read it — because, as the data-representation topic showed, every file is ultimately just a long sequence of bytes, and those identical bytes are meaningless unless a program knows the convention for interpreting them. The file extension — the short suffix after the dot in a name like `photo.jpg` or `report.pdf`, the kind of name the working-with-a-computer topic described — is a hint about which format the bytes are in, so the operating system knows which program to open it with. It is only a label, though: renaming `song.mp3` to `song.txt` does not change the bytes inside at all, it just mislabels them, which is why a text program then opens it and shows gibberish. What actually identifies a format is its internal structure, and many formats begin with a few fixed bytes called a magic number that act as a signature a program can check to confirm the file really is what its extension claims. Formats divide broadly into two families. Text formats store data as human-readable characters: a `.txt` file, or structured text like the JSON the API topic mentioned, can be opened in any text editor and read directly. Binary formats instead store data as raw bytes packed for the machine — images, audio, video, and compiled programs — which are compact and efficient but look like nonsense in a text editor because they were never meant to be read as characters. A second useful split is open versus proprietary: an open format has a public specification anyone can implement, so many different programs can reliably read and write it (which is why PNG images or plain text open almost everywhere), while a proprietary format is controlled by one company and may be fully usable only in its software, a real consideration when you want your files to remain accessible for years. Formats also frequently involve compression, shrinking the byte count to save space and transfer time: some compression is lossless, perfectly reconstructing the original (as in ZIP archives or PNG images), while some is lossy, permanently discarding detail the eye or ear is unlikely to miss in exchange for much smaller files (as in JPEG photos or MP3 audio) — which is why repeatedly re-saving a JPEG slowly degrades it. The practical takeaway is that a file format is simply a shared agreement about how to interpret a file's bytes: the extension advertises which agreement is in use, the internal structure makes it real, and whether a format is text or binary, open or proprietary, compressed lossily or losslessly, all comes down to choices about how those underlying bytes are organized.

Every file is just bytes
identical bytes mean nothing without a convention
A file format is that convention
the agreed arrangement a program knows how to read
Extension (.jpg, .pdf)
a label hinting which format — only a hint
Magic number
fixed starting bytes that truly identify it
Text vs binary, open vs proprietary, compressed or not
all just choices about how the bytes are organized
Same Bytes, Different Meaning the format is the convention for interpreting the bytes; the extension just labels it a sequence of bytes on disk FF D8 FF E0 00 10 4A 46 ... read as a JPEG image the magic number FF D8 says "JPEG" an image viewer shows a photo correct convention read as plain text same bytes, wrong convention a text editor shows gibberish renaming to .txt does not change the bytes
Compression: Lossless vs. Lossy shrinking the bytes — with or without throwing detail away Lossless shrinks, then rebuilds the original exactly nothing is lost used where exactness matters: ZIP archives, PNG images, text re-saving never degrades it Lossy permanently discards hard-to-notice detail for much smaller files used for media: JPEG photos, MP3 audio, most video re-saving repeatedly slowly degrades it

Take what is a file format further

Ask the copilot about this term, or have our engineers assess it against your process.