TL;DR
Remove sensitive metadata from images before sharing them online. Every photo contains hidden EXIF data including GPS coordinates, device info, and timestamps that can reveal your location and identity.
Prerequisites:
- Command-line access (Linux, macOS, or Windows with WSL)
- ExifTool installed on your system
What you’ll learn:
- How to view and understand image metadata
- Remove all metadata from single or multiple images
- Selectively strip GPS data while keeping other info
- Create automated workflows for batch processing
- Verify metadata removal
Introduction
Modern smartphones and cameras embed detailed metadata in every photo - GPS coordinates showing exactly where you were, device identifiers, and timestamps. Most people share these images online without realizing they’re broadcasting their home address, daily routines, and device information. ExifTool removes this metadata in seconds.
Why Clean Image Metadata?
Every photo you take contains hidden metadata - EXIF data that includes:
GPS coordinates(exact location where photo was taken)Device information(camera model, phone type)Timestamps(when the photo was actually taken)Software details(editing apps used)Camera settings(lens info, focal length, ISO)
Before sharing images online, you should strip this data to protect your privacy.
Installing ExifTool
ExifTool is a powerful command-line tool for reading and writing metadata.
Linux (Debian/Ubuntu)
sudo apt install libimage-exiftool-perl
Linux (Arch)
sudo pacman -S perl-image-exiftool
macOS
brew install exiftool
Verify Installation
exiftool -ver
Viewing Metadata
First, let’s see what metadata your image contains:
exiftool image.jpg
This outputs everything - GPS coordinates, camera model, timestamps, and more.
Removing All Metadata
Single Image
The simplest approach - nuke everything:
exiftool -all= image.jpg
This creates a backup (image.jpg_original) and strips all metadata from the original.
Remove Backup Files
If you don’t want the backup:
exiftool -all= -overwrite_original image.jpg
Batch Processing
Clean all images in a directory:
exiftool -all= -overwrite_original -ext jpg -ext png -ext jpeg .
This processes all JPG, PNG, and JPEG files in the current directory.
Recursive Processing
Clean images in subdirectories too:
exiftool -all= -overwrite_original -r -ext jpg -ext png .
Selective Metadata Removal
Sometimes you want to keep some data (like orientation) but remove sensitive info.
Remove GPS Only
exiftool -gps:all= image.jpg
Remove Common Identifiable Data
exiftool -GPS:all= -Creator= -Rights= -Comment= -overwrite_original image.jpg
Keep Orientation, Remove Everything Else
exiftool -all= -tagsfromfile @ -orientation -overwrite_original image.jpg
Real-World Usage
Before Posting to Social Media
# Clean all images in a folder before upload
exiftool -all= -overwrite_original -ext jpg ~/Pictures/to-upload/
Automated Workflow
Create a simple script ~/bin/clean-images:
#!/bin/bash
# Clean metadata from images
if [ $# -eq 0 ]; then
echo "Usage: clean-images <file1> [file2] ..."
exit 1
fi
exiftool -all= -overwrite_original "$@"
echo "Cleaned metadata from $# file(s)"
Make it executable:
chmod +x ~/bin/clean-images
Now you can simply run:
clean-images vacation-photo.jpg
Verify Metadata Removal
After cleaning, verify the metadata is gone:
exiftool image.jpg
You should only see basic file information (file size, type, etc.) with no personal data.
Important Notes
- Social media platforms often strip metadata automatically, but don’t rely on this
- Websites may not strip metadata - assume they don’t
- Screenshots typically don’t contain GPS data, but may contain other identifying info
- PNG files can also contain metadata - don’t forget them
Quick Reference
# View metadata
exiftool image.jpg
# Remove all metadata (with backup)
exiftool -all= image.jpg
# Remove all metadata (no backup)
exiftool -all= -overwrite_original image.jpg
# Batch clean directory
exiftool -all= -overwrite_original -ext jpg -ext png .
# Remove GPS only
exiftool -gps:all= -overwrite_original image.jpg
# Recursive directory clean
exiftool -all= -overwrite_original -r -ext jpg .
Notes
Every photo from modern smartphones embeds GPS coordinates, device identifiers, and timestamps by default. Strip metadata before posting images online - it takes 5 seconds and prevents doxxing. Most social media platforms remove some metadata during upload, but not all of it, and you’re trusting them to do it correctly.
[references] ▸
-
[1.1]
ExifTool by Phil Harvey — Official ExifTool documentation and downloads
-
[1.2]
ExifTool FAQ — Common questions and advanced usage
-
[2.1]
EFF: Metadata Removal Guide — Why metadata matters for privacy
[changelog] ▸
- → Initial publication
Disclaimer
Use the information provided here at your own risk, but if you find errors or issues in this guide, leave a comment and I’ll try to address them ASAP.
Comments