Metadata Editor

EXIF EditorEXIF ReaderRemove MetadataGuidesGlossaryAbout

How to find where a photo was taken from its metadata

By Alexis Guay

To find where a photo was taken, read the GPS tags in its EXIF data: GPSLatitude and GPSLongitude, plus GPSLatitudeRef and GPSLongitudeRef, which say north or south and east or west. Convert the values to decimal degrees, paste them into Google Maps or OpenStreetMap, and you have the spot, usually within a few meters for a phone photo taken outdoors. If the file has no GPS tags, the metadata cannot tell you where it was shot. At best it carries a typed place name in IPTC.

How to find where a photo was taken: check for GPS first

The quickest check is our EXIF reader: upload a JPEG, TIFF, PNG or WebP file and it lists the GPS tags it finds: coordinates, altitude, direction and accuracy. On a phone, the map in the iPhone Photos Info panel or the Google Photos About panel answers the same question; see the iPhone and Android guides. With ExifTool:

exiftool -a -G1 -s -GPS:all IMG_0412.jpg
[GPS]           GPSVersionID                    : 2.3.0.0
[GPS]           GPSLatitudeRef                  : North
[GPS]           GPSLatitude                     : 37 deg 48' 25.10"
[GPS]           GPSLongitudeRef                 : West
[GPS]           GPSLongitude                    : 122 deg 28' 37.80"
[GPS]           GPSAltitudeRef                  : Above Sea Level
[GPS]           GPSAltitude                     : 67.3 m
[GPS]           GPSSpeedRef                     : km/h
[GPS]           GPSSpeed                        : 0
[GPS]           GPSImgDirectionRef              : True North
[GPS]           GPSImgDirection                 : 351.2
[GPS]           GPSHPositioningError            : 4.7 m

Keep the -a. Without it, ExifTool hides the raw GPSLatitude and GPSLongitude lines behind the Composite tags of the same name, and the GPS group looks like it has no coordinates.

One trap: uploading from a phone browser can remove GPS before the file leaves the phone. Android hides location from apps that lack the media-location permission, browsers included, and the iOS photo picker leaves location out unless you include it under Options. When it matters, copy the original to a computer and check it there.

How the coordinates are stored

GPS data sits in its own IFD, referenced from IFD0 by the GPSInfo pointer (0x8825). The four tags that matter:

TagIDTypeTest file value
GPSLatitudeRef0x0001ASCIIN
GPSLatitude0x00023 rationals37/1 48/1 251/10
GPSLongitudeRef0x0003ASCIIW
GPSLongitude0x00043 rationals122/1 28/1 189/5

Each coordinate is three unsigned rationals: degrees, minutes, seconds. There is no minus sign anywhere in the value; the hemisphere lives only in the Ref tag. exiftool -v3 shows the raw fractions:

  | | 1)  GPSLatitudeRef = N
  | | 2)  GPSLatitude = 37 48 25.1 (37/1 48/1 251/10)
  | | 3)  GPSLongitudeRef = W
  | | 4)  GPSLongitude = 122 28 37.8 (122/1 28/1 189/5)

Devices split the value differently. Some write whole degrees and minutes with fractional seconds, as above; others put all the precision in the minutes and write 0 seconds. The conversion below works for both. The GPS coordinates glossary entry covers the remaining edge cases.

Converting degrees, minutes and seconds to decimal

The formula is degrees + minutes / 60 + seconds / 3600, then a minus sign if the Ref is S or W. For the test file:

Latitude:  37 + 48/60 + 25.10/3600  = 37 + 0.800000 + 0.006972  = 37.806972   (N, positive)
Longitude: 122 + 28/60 + 37.80/3600 = 122 + 0.466667 + 0.010500 = 122.477167  (W, negative)
Result:    37.806972, -122.477167

Forget the W and the point jumps to the sea off China's Shandong peninsula. That is the classic mistake in hand-rolled EXIF parsers, and it is why a tool that prints bare numbers without the Ref is not good enough.

Six decimal places is about 11 centimeters of latitude, already finer than any phone fix. Five decimals (about 1.1 m) is plenty.

Let ExifTool do the math

exiftool -n -GPSLatitude -GPSLongitude IMG_0412.jpg
GPS Latitude                    : 37.8069722222222
GPS Longitude                   : -122.477166666667

With -n and no group prefix, those names resolve to ExifTool's Composite tags, which already apply the Ref sign. Ask for -GPS:GPSLongitude explicitly and you get 122.477166666667, unsigned. For a readable fixed-precision version, use -c:

exiftool -c "%.6f" -GPSPosition IMG_0412.jpg
GPS Position                    : 37.806972 N, 122.477167 W

And for a string you can paste straight into a map search box:

exiftool -n -p '$GPSLatitude,$GPSLongitude' IMG_0412.jpg
37.8069722222222,-122.477166666667

In the Windows command prompt, swap the single quotes for double quotes.

Opening the spot in Google Maps or OpenStreetMap

Paste 37.806972, -122.477167 into the Google Maps search box. It also accepts the DMS form, 37°48'25.1"N 122°28'37.8"W. If you are building links, both services take coordinates in the URL:

https://www.google.com/maps/search/?api=1&query=37.806972,-122.477167
https://www.openstreetmap.org/?mlat=37.806972&mlon=-122.477167#map=18/37.806972/-122.477167

The test coordinates land near the San Francisco end of the Golden Gate Bridge. Use satellite view to check a location; a pin on a plain street map hides whether the shot was taken from a balcony or the middle of the road.

Which way the camera was pointing

GPSImgDirection (0x0011) records the compass heading of the lens, from 0 to just under 360 degrees, and GPSImgDirectionRef says whether that is relative to true north (T) or magnetic north (M). The test file has 351.2 with T, so nearly due north. Phones fill it from the magnetometer, which metal railings, car interiors and magnetic cases can easily throw off. Trust it to the nearest compass point, not to the degree. More in the GPSImgDirection entry.

How accurate the position is

GPSHPositioningError (0x001F), added in EXIF 2.3 (2010), stores the estimated horizontal error in meters. The test file says 4.7 m, a typical outdoor figure. Phones do not rely on satellites alone: Apple's own documentation says the Camera's location comes from cellular, Wi-Fi, GPS and Bluetooth data. Indoors or between tall buildings, the fix may come from Wi-Fi and be off by a whole building; a large error value is the hint. More in the positioning error entry.

Altitude is less reliable than the horizontal position, and GPSDateStamp with GPSTimeStamp records the UTC time of the fix, which is not always the moment the shutter fired. Our reader shows the GPS position, altitude and accuracy tags but not the GPS time stamps; ExifTool shows all of them.

Place names in IPTC and XMP

Some photos carry a written location instead of, or next to, coordinates. Photographers and agencies fill these fields by hand, and some software fills them by reverse-geocoding the GPS.

FieldIPTC IIMXMP
City2:90 Cityphotoshop:City
Sub-location2:92 Sub-locationIptc4xmpCore:Location
State or province2:95 Province-Statephotoshop:State
Country2:101 Country-PrimaryLocationNamephotoshop:Country
Country code2:100Iptc4xmpCore:CountryCode
exiftool -G1 -s -IPTC:City -IPTC:Sub-location -IPTC:Province-State -IPTC:Country-PrimaryLocationName IMG_0412.jpg
[IPTC]          City                            : San Francisco
[IPTC]          Sub-location                    : Golden Gate Welcome Center
[IPTC]          Province-State                  : CA
[IPTC]          Country-PrimaryLocationName     : United States

These fields describe a place, not a measurement, and they can describe what the photo shows rather than where the camera stood. The newer IPTC Extension schema separates the two with LocationCreated and LocationShown. The old IIM fields are also short: City and Sub-location allow 32 bytes, and ExifTool truncates longer values with an "exceeds length limit" warning. Our EXIF reader does not display these place-name fields; ExifTool does.

Why most photos from social networks have no GPS

Facebook, Instagram, X and most large platforms re-encode uploads and drop the EXIF block, GPS included, so a photo saved from a feed almost never has coordinates. Messaging apps that compress images usually strip it too, while sending the same image as a file or document often keeps it. Email attachments, AirDrop and file-sharing links to the original (Dropbox, Google Drive) usually keep everything. The social media guide lists what each platform keeps.

Screenshots never have GPS. Once the coordinates are gone, only visual clues remain, and those are not metadata.

Using location data responsibly

Coordinates in a stranger's photo often point to a home or a school. Checking your own files before you post them and verifying where a news image was taken are the normal uses of everything above. Using someone's photos to work out where they live is a different act, and in many places it falls under stalking or harassment law. If you are on the sharing side, removing the location takes a minute.

FAQ

Related guides

How to remove location from photos and stop geotagging

Turn off geotagging on iPhone and Android, remove GPS from existing photos on phone, Windows or Mac, and clear XMP GPS and IPTC city fields with ExifTool.

Does social media remove metadata from your photos?

What Facebook, Instagram, X, WhatsApp, Telegram, Signal, Discord, iMessage, email and cloud storage do to EXIF and GPS, and how to test any platform yourself.

How to view photo metadata on iPhone, and what Photos hides

Swipe up on a photo in the iPhone Photos app to see camera, lens, exposure and map. What that panel leaves out, and how Shortcuts and Files show the rest.

How to view photo metadata on Android phones

Swipe up in Google Photos or open Details in Samsung Gallery to see camera, exposure and location data. Why some apps show no GPS, and what sharing removes.

Other Metadata Tools