ExifTool: The Complete Guide to Reading, Writing & Manipulating File Metadata
NotionWhat is ExifTool?
ExifTool is a free, open-source, platform-independent Perl library and command-line application created by Phil Harvey for reading, writing, and editing metadata in a massive range of file formats. It supports EXIF, GPS, IPTC, XMP, JFIF, GeoTIFF, ICC Profile, Photoshop IRB, FlashPix, AFCP, ID3, and many more metadata formats.
In the context of penetration testing and OSINT, ExifTool is invaluable. Uploaded images, documents, and PDFs often contain hidden metadata that reveals GPS coordinates, author names, software used, device serial numbers, and more. Attackers use it for reconnaissance; defenders use it to sanitize files before publishing.
Installation
On Kali Linux (Pre-installed)
ExifTool comes pre-installed on Kali Linux. Verify it with:
exiftool -verExpected Output:
12.76Install / Update on Debian/Ubuntu
sudo apt update && sudo apt install libimage-exiftool-perlInstall on macOS
brew install exiftoolInstall on Windows
Download from the official site at exiftool.org, extract the zip, and rename exiftool(-k).exe to exiftool.exe. Add it to your system PATH.
Install from Source (Latest Version)
cd /tmp
wget https://exiftool.org/Image-ExifTool-12.76.tar.gz
tar -xzf Image-ExifTool-12.76.tar.gz
cd Image-ExifTool-12.76
perl Makefile.PL
make
sudo make installCore Concepts
Metadata is data about data. When you take a photo, your camera embeds information like the date, time, GPS location, camera model, lens info, ISO, shutter speed, and more into the file itself. Documents embed author names, software versions, revision history, and timestamps.
ExifTool reads and writes metadata across hundreds of file types including JPEG, PNG, TIFF, PDF, DOCX, MP4, MP3, HEIC, RAW formats (CR2, NEF, ARW), and more.
Key metadata standards:
- EXIF — Camera settings, date/time, GPS coordinates
- IPTC — Captions, keywords, copyright, credits
- XMP — Adobe's extensible metadata platform
- ID3 — Audio file tags (MP3)
- ICC Profile — Color management data
- MakerNotes — Proprietary camera manufacturer data
Reading Metadata (Extraction)
View All Metadata from a File
exiftool photo.jpgExample Output:
ExifTool Version Number : 12.76
File Name : photo.jpg
Directory : .
File Size : 3.2 MB
File Modification Date/Time : 2026:03:01 14:23:45-08:00
File Access Date/Time : 2026:03:06 09:15:22-08:00
File Type : JPEG
File Type Extension : jpg
MIME Type : image/jpeg
Image Width : 4032
Image Height : 3024
Camera Model Name : iPhone 15 Pro
Lens Model : iPhone 15 Pro back triple camera
GPS Latitude : 37 deg 56' 10.20" N
GPS Longitude : 122 deg 20' 42.60" W
Create Date : 2026:03:01 14:23:45
ISO : 64
Shutter Speed : 1/1250
Aperture : 1.8
Software : 18.3.1
Make : AppleView Only Common Tags (Short Output)
exiftool -common photo.jpgExample Output:
FileName : photo.jpg
FileSize : 3.2 MB
Model : iPhone 15 Pro
DateTimeOriginal: 2026:03:01 14:23:45
ImageSize : 4032x3024
Quality :
FocalLength : 6.8 mm
ShutterSpeed : 1/1250
Aperture : 1.8
ISO : 64
WhiteBalance : Auto
Flash : Off, Did not fireExtract Specific Tags
exiftool -Make -Model -GPSLatitude -GPSLongitude photo.jpgOutput:
Make : Apple
Camera Model Name : iPhone 15 Pro
GPS Latitude : 37 deg 56' 10.20" N
GPS Longitude : 122 deg 20' 42.60" WExtract GPS Coordinates in Decimal Format
exiftool -n -GPSLatitude -GPSLongitude photo.jpgOutput:
GPS Latitude : 37.9361667
GPS Longitude : -122.3451667The -n flag disables print conversion, giving you raw numeric values you can plug directly into Google Maps.
View Metadata in JSON Format
exiftool -json photo.jpgOutput:
[{
"SourceFile": "photo.jpg",
"FileName": "photo.jpg",
"FileSize": "3.2 MB",
"Make": "Apple",
"Model": "iPhone 15 Pro",
"GPSLatitude": "37 deg 56' 10.20\" N",
"GPSLongitude": "122 deg 20' 42.60\" W"
}]View Metadata in CSV Format
exiftool -csv photo.jpgView Metadata in XML Format
exiftool -X photo.jpgView Metadata in HTML Table
exiftool -htmldump photo.jpg > metadata_report.htmlThis creates a visual HTML dump of the entire binary metadata structure — extremely useful for forensic analysis.
View Only EXIF Data
exiftool -exif:all photo.jpgView Only XMP Data
exiftool -xmp:all photo.jpgView Only IPTC Data
exiftool -iptc:all photo.jpgView MakerNotes (Manufacturer-Specific Data)
exiftool -makernotes:all photo.jpgView Thumbnail Image Info
exiftool -ThumbnailImage -b photo.jpg > thumbnail.jpgThis extracts the embedded thumbnail from the JPEG — often overlooked during metadata scrubbing.
Reading Metadata from Documents & Other Files
PDF Files
exiftool report.pdfExample Output:
File Name : report.pdf
File Size : 1.8 MB
File Type : PDF
PDF Version : 1.7
Title : Q4 Financial Report
Author : John Smith
Creator : Microsoft Word 2021
Producer : macOS Version 14.2 Quartz PDFContext
Create Date : 2026:01:15 09:30:22-08:00
Modify Date : 2026:02:28 16:45:11-08:00
Page Count : 24Microsoft Office Documents (DOCX, XLSX, PPTX)
exiftool presentation.pptxExample Output:
File Name : presentation.pptx
Creator : Jane Doe
Last Modified By : Marketing Team
Revision Number : 12
Create Date : 2026:01:10 08:00:00Z
Modify Date : 2026:03:01 17:30:00Z
Total Edit Time : 4.5 hours
Words : 2340
Application : Microsoft Office PowerPoint
Slides : 18
Company : Acme CorpAudio/Video Files (MP3, MP4, MOV)
exiftool video.mp4Example Output:
File Name : video.mp4
File Size : 245 MB
MIME Type : video/mp4
Major Brand : Apple QuickTime (.MOV/QT)
Duration : 0:05:32
Image Size : 3840x2160
Video Frame Rate : 60
Audio Channels : 2
Audio Sample Rate : 48000
Compressor Name : HEVC
GPS Latitude : 37 deg 56' 10.20" N
GPS Longitude : 122 deg 20' 42.60" W
Create Date : 2026:02:14 18:22:33Writing & Editing Metadata
Change the Author Tag
exiftool -Author="Abishek Lakandri" document.pdfOutput:
1 image files updatedExifTool automatically creates a backup file (document.pdf_original) unless you use -overwrite_original.
Write Multiple Tags at Once
exiftool -Artist="John Doe" -Copyright="2026 All Rights Reserved" -Comment="Shot in San Francisco" photo.jpgSet GPS Coordinates on an Image
exiftool -GPSLatitude=37.7749 -GPSLongitude=-122.4194 -GPSLatitudeRef=N -GPSLongitudeRef=W photo.jpgChange the Creation Date
exiftool -DateTimeOriginal="2025:12:25 10:00:00" photo.jpgShift All Dates by a Time Offset
Useful when your camera clock was set wrong:
exiftool "-DateTimeOriginal+=1:30:0" photo.jpgThis adds 1 hour and 30 minutes to the original date/time.
Shift Dates Backward
exiftool "-DateTimeOriginal-=0:0:0 3:0:0" photo.jpgSubtracts 3 hours from the date.
Set the Title and Subject on a PDF
exiftool -Title="Project Alpha Report" -Subject="Quarterly Analysis" report.pdfWrite IPTC Keywords
exiftool -Keywords="cybersecurity" -Keywords="kali" -Keywords="metadata" photo.jpgWrite XMP Tags
exiftool -XMP:Creator="My Name" -XMP:Description="Sunset at the pier" photo.jpgOverwrite Original (No Backup)
exiftool -overwrite_original -Artist="Anonymous" photo.jpgRemoving / Stripping Metadata (OPSEC Critical)
This is one of the most important ExifTool functions for security professionals. Before uploading any file to the internet, strip all metadata to prevent information leakage.
Remove ALL Metadata from a File
exiftool -all= photo.jpgOutput:
1 image files updatedVerify by running exiftool photo.jpg again — you'll see only basic file system tags remain.
Remove All Metadata and Overwrite Original
exiftool -all= -overwrite_original photo.jpgRemove Only GPS Data
exiftool -gps:all= photo.jpgRemove Only EXIF Data (Keep IPTC/XMP)
exiftool -exif:all= photo.jpgRemove All Metadata Except Certain Tags
exiftool -all= --ImageWidth --ImageHeight --FileType photo.jpgThe double dash -- means "exclude from removal" so these tags are preserved.
Remove Author and Creator from PDFs
exiftool -Author= -Creator= -Producer= report.pdfRemove Metadata from All Files in a Directory
exiftool -all= -overwrite_original /path/to/directory/Remove Metadata Recursively (All Subdirectories)
exiftool -all= -overwrite_original -r /path/to/directory/Bulk / Batch Operations
Process All JPEGs in a Directory
exiftool -Artist="My Studio" *.jpgProcess Files Recursively
exiftool -r -Artist="My Studio" /photos/Process Only Specific File Types
exiftool -ext jpg -ext png -ext tiff -Artist="My Studio" /photos/Rename Files Based on Date Taken
exiftool '-FileName<DateTimeOriginal' -d '%Y%m%d_%H%M%S%%-c.%%le' /photos/Before: IMG_4532.jpg
After: 20260301_142345.jpg
The %%-c adds a copy number if duplicates exist, and %%le preserves the lowercase extension.
Organize Photos into Date-Based Folders
exiftool '-Directory<DateTimeOriginal' -d '/photos/sorted/%Y/%m/%d' /photos/unsorted/Result: Files get moved into a structure like /photos/sorted/2026/03/01/
Copy Metadata from One File to Another
exiftool -TagsFromFile source.jpg target.jpgCopy Only GPS Tags Between Files
exiftool -TagsFromFile source.jpg -gps:all target.jpgCopy All Metadata from One Format to Another
exiftool -TagsFromFile original.cr2 converted.jpgCreate a CSV Report of All Image Metadata
exiftool -csv -r /photos/ > metadata_report.csvCreate a JSON Report
exiftool -json -r /photos/ > metadata_report.jsonProcess Files Matching a Condition
Only process files taken with an iPhone:
exiftool -if '$Make eq "Apple"' -Artist="iPhone Shot" /photos/Only process files with GPS data:
exiftool -if '$GPSLatitude' -json /photos/Advanced Use Cases
Extract Embedded Thumbnails
exiftool -b -ThumbnailImage photo.jpg > thumb.jpgSometimes the thumbnail contains the original uncropped image — a known privacy risk.
Extract All Embedded Images from a File
exiftool -a -b -W %d%f_%t%-c.%s -preview:all photo.jpgView the Hex Dump of Metadata
exiftool -v3 photo.jpgThe -v (verbose) flag levels 1-5 give increasingly detailed debug output. -v3 shows the raw hex data being parsed.
Compare Metadata Between Two Files
diff <(exiftool file1.jpg) <(exiftool file2.jpg)Geolocation Tracking from Images
Extract GPS from every image in a folder and output to CSV:
exiftool -csv -GPSLatitude -GPSLongitude -GPSAltitude -DateTimeOriginal -r /evidence/ > gps_tracking.csvYou can then import this CSV into Google Earth, QGIS, or any mapping tool to visualize movement patterns.
Detect if Metadata Has Been Tampered With
exiftool -validate -warning -error -a photo.jpgLook for warnings like "Bad ExifIFD SubDirectory" or unexpected tag counts.
Read Metadata from URLs (Pipe from curl)
curl -s https://example.com/image.jpg | exiftool -The - tells ExifTool to read from stdin.
Write Metadata Using a Config File
Create a file args.txt:
-Artist=My Name
-Copyright=2026 All Rights Reserved
-Comment=Processed with ExifToolThen run:
exiftool -@ args.txt photo.jpgConditional Writing with -if
Add a copyright tag only to photos taken in 2026:
exiftool -if '$DateTimeOriginal ge "2026:01:01"' -Copyright="2026 My Copyright" /photos/OSINT & Forensics Use Cases
Investigate a Suspicious Document
When analyzing a phishing document or suspicious PDF:
exiftool -a -u -g1 suspicious.pdf-
-ashows duplicate tags -
-ushows unknown tags -
-g1groups output by tag group for readability What to look for: -
Author / Creator — May reveal the attacker's name or username
-
Producer / Software — Shows what tool created the document
-
Create/Modify Dates — Timeline of document creation
-
Metadata timestamps vs file system timestamps — Discrepancies suggest tampering
-
Embedded GPS — May reveal the attacker's location
-
Serial numbers — Camera serial numbers are unique identifiers
Extract Software and OS Information
exiftool -Software -Producer -Creator -CreatorTool document.pdfExample Output:
Software : Microsoft Office Word 2019
Producer : macOS Version 14.3 Quartz PDFContext
Creator : Word
Creator Tool : Microsoft Word 16.82This reveals the exact software version and operating system used.
Extract Unique Camera Serial Number
exiftool -SerialNumber -InternalSerialNumber photo.jpgCamera serial numbers can be used to link multiple images to the same device.
Mass OSINT Extraction Script
Extract key OSINT data from all files in an evidence folder:
exiftool -r -csv \
-FileName \
-FileType \
-Make -Model \
-SerialNumber \
-Software \
-Author -Creator \
-GPSLatitude -GPSLongitude \
-DateTimeOriginal \
-CreateDate -ModifyDate \
/evidence/ > osint_report.csvUseful Flags Reference
Performance Tips
Use stay_open for Batch Processing
Starting ExifTool once and piping commands is much faster than invoking it per file:
exiftool -stay_open True -@ - <<EOF
-json
photo1.jpg
-execute
-json
photo2.jpg
-execute
-stay_open
False
EOFThis avoids the Perl startup overhead for each file.
Process Large Directories Efficiently
For directories with thousands of files:
find /photos -name '*.jpg' | exiftool -@ - -csv > report.csvSecurity Considerations
Always strip metadata before uploading files publicly. Real-world breaches have occurred because of metadata exposure, including revealing military base locations from soldiers' geotagged photos, identifying anonymous whistleblowers from document metadata, and tracing journalists' locations from photo GPS data.
Quick pre-upload sanitization command:
exiftool -all= -overwrite_original -r ./upload_folder/Verify sanitization worked:
exiftool -a -u upload_folder/photo.jpgYou should only see basic file system attributes like file name, size, and MIME type.
Summary
ExifTool is one of the most versatile tools in any security professional's toolkit. Whether you are conducting OSINT investigations, performing digital forensics, sanitizing files for OPSEC, or simply organizing your photo library — ExifTool handles it all from a single command-line interface.
Key Takeaways:
- Use
exiftool filenameto quickly view all metadata - Use
exiftool -all= filenameto strip all metadata - Use
-gps:all=to specifically remove location data - Use
-jsonor-csvflags for structured output - Use
-rfor recursive directory processing - Use
-TagsFromFileto copy metadata between files - Use
-iffor conditional batch processing - Always sanitize files before uploading to the internet
Share this post
Help this article travel further
One tap opens the share sheet or pre-fills the post for the platform you want.