Knowledge Base

What Does Byte Order Mean?

byte-order

The Byte Order is one of the hidden details you find in a file when you check its metadata. Find out what it means and what it tells you about how your file was written.

The Byte Order, also known as endianness, describes the sequence in which the bytes of a larger value are stored. Computers can write those bytes starting from either end, and the file has to say which end it used so that anything reading it later gets the same number back.

The two orders

A byte on its own is unambiguous. Numbers too large for one byte have to be split across several, and that is where the two conventions part company:

  • Big-endian: storage or sending starts with the byte containing the most significant bits, with significance decreasing from there
  • Little-endian: storage or sending starts with the byte containing the least significant bits, with significance increasing from there

Take the number 4660, which needs two bytes. A big-endian file writes them as 12 34 and a little-endian file as 34 12. Same number, opposite order. Mixed forms exist as well, described as mixed-endian or middle-endian, but they are rare. Both of the main orders are in everyday use, and which one you see depends on the device or program that created the file.

Which files carry it

The field is most familiar from TIFF and from everything built on the TIFF structure, which includes the Exif metadata block inside JPEG photos and camera RAW formats such as NEF, CR2, ARW and DNG. Those files begin with a two-letter marker, II for Intel or MM for Motorola, the companies whose processors made each order common. A report usually spells this out as Little-endian (Intel, II) or Big-endian (Motorola, MM). The camera, scanner or program that wrote the metadata chose it.

Audio containers made the same choice at the level of the whole format: WAV stores its values little-endian and AIFF stores them big-endian, which is one reason two formats that hold the very same sound samples are not interchangeable byte for byte.

Why it matters for your file

Byte order is the reason metadata written on one machine can look like nonsense on another. A reader that ignores the marker, or assumes the wrong order, does not fail politely: it produces impossible dates, absurd exposure values and lengths that point past the end of the file, or it simply declares the metadata unreadable. Knowing the order tells you how the file can be opened and processed correctly.

It matters twice over if you edit metadata, because new values have to be written back in the order the file declares. And if that marker itself is damaged, the whole metadata block usually becomes unreadable even though the image or audio inside the file is perfectly intact. The field describes only how the file is laid out, so it holds nothing personal about you or your device.