Metadata Editor

EXIF EditorEXIF ReaderRemove MetadataGuidesGlossaryAbout

Orientation: how a photo tells viewers which way is up

At a glance

ExifTool tag namesEXIF:Orientation
Tag ID / location0x0112
CategoryImage & file structure
Example valueRotate 90 CW (6)
On metadata-editor.comShown in the EXIF reader, editable in the EXIF editor (JPEG, TIFF)

Cameras and phones usually save pixels in the sensor's native wide layout and write how the device was held into the Orientation tag. The viewer then rotates or mirrors the image on display. A phone held upright typically writes 6.

The tag sits in IFD0 as a 16-bit unsigned integer, in JPEG and TIFF files alike. Here are the values with the text ExifTool prints (-n gives the number):

ValueExifTool prints
1Horizontal (normal)
2Mirror horizontal
3Rotate 180
4Mirror vertical
5Mirror horizontal and rotate 270 CW
6Rotate 90 CW
7Mirror horizontal and rotate 90 CW
8Rotate 270 CW

"Rotate 90 CW" is the instruction for the viewer: turn the stored image 90 degrees clockwise to display it upright. The mirrored values are rare in camera files.

Who honors it

Phone galleries, macOS Preview, Windows Photos and current browsers do; CSS has defaulted to image-orientation: from-image since 2020. Code is another story. Pillow returns the stored pixels until you call ImageOps.exif_transpose(): the same test file opened as 1200x800 and came back as 800x1200 after the call. Thumbnailers and upload scripts that skip that step produce sideways images.

Why stripping metadata can rotate a photo

Delete the tag and viewers show the raw sensor layout, so the portrait shot lies on its side. Any full strip does this, including exiftool -all= and our metadata remover. Two ways around it:

# bake the rotation into the pixels (re-encodes the JPEG), Orientation becomes 1
convert photo.jpg -auto-orient upright.jpg
# or strip everything but keep the tag
exiftool -all= -tagsfromfile @ -Orientation photo.jpg

The second command left only Orientation (still Rotate 90 CW) plus the resolution defaults ExifTool writes into a fresh IFD0. The metadata removal guide covers the rest of the workflow.

You can read and change the tag in the EXIF editor for JPEG and TIFF. That changes how viewers display the image, not the pixels, and the stored width and height stay the same.

FAQ

Related fields

Where Orientation comes up

Other Metadata Tools