Metadata Editor

EXIF EditorEXIF ReaderRemove MetadataGuidesGlossaryAbout

Byte order: II, MM and the first two bytes of EXIF

At a glance

ExifTool tag namesFile:ExifByteOrder
Tag ID / locationTIFF header, bytes 0 to 1 (II or MM)
CategoryImage & file structure
Example valueBig-endian (Motorola, MM)
On metadata-editor.comNot shown in our reader or editor. The metadata remover strips it with everything else.

EXIF is a small TIFF file, and a TIFF file opens with two identical letters. II means little-endian, least significant byte first, the order Intel processors use. MM means big-endian, the Motorola order. Then comes the number 42, written in that order, then the offset of the first IFD. Every integer and rational in the block follows the byte order chosen there.

Here are the first eight bytes of two TIFF files:

$ xxd -l 8 little.tif
00000000: 4949 2a00 0800 0000                      II*.....
$ xxd -l 8 big.tif
00000000: 4d4d 002a 002b f208                      MM.*.+..

2a00 versus 002a: the same 42, stored in opposite orders. In a JPEG, the same header follows the Exif\0\0 identifier at the start of the APP1 segment.

ExifTool reports it as File:ExifByteOrder:

$ exiftool -G1 -s -ExifByteOrder little.tif big.tif
======== little.tif
[File]          ExifByteOrder                   : Little-endian (Intel, II)
======== big.tif
[File]          ExifByteOrder                   : Big-endian (Motorola, MM)
    2 image files read

Who writes which

Nikon and Apple iPhones write MM. Canon writes II, and its CR2 raw files start with the same II* header. When ExifTool creates EXIF from scratch, it uses MM. Neither choice is better: any compliant reader handles both, and the order has no effect on image quality or file size.

When it matters

Mostly when something parses EXIF by hand. A script that reads tag values at fixed offsets without checking the header will get 0x1200 instead of 0x0012 from a file in the other order. The other case is maker notes: some of these proprietary blocks use a different order from the main EXIF, and ExifTool then shows a separate MakerNoteByteOrder.

You can rewrite an existing block in the other order with ExifTool, copying the tags back:

exiftool -exif:all= -tagsfromfile @ -exif:all -unsafe -thumbnailimage -ExifByteOrder=II photo.jpg

On a test file this kept Make and the thumbnail. Setting -ExifByteOrder alone only affects EXIF that ExifTool creates, not an existing block. Our editor writes tags into the existing block without changing its order, as ExifTool does by default. The EXIF data guide shows how the header leads to IFD0.

Related fields

Where Byte Order comes up

Other Metadata Tools