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.