A photo from a phone carries more than pixels. It can hold the GPS position where it was taken, the phone model, the time, and the editing software. If you post it as is, you may share your home address without meaning to.
Removing this data is simple once you know where it lives.
Where the data sits
In a JPEG, metadata lives in segments that start with a marker:
-
0xFFE1(APP1) holds EXIF, and also XMP. EXIF begins with the bytesExif. -
0xFFED(APP13) holds Photoshop and IPTC data. -
0xFFE2(APP2) holds the ICC colour profile.
GPS position is stored inside the EXIF block. Camera make, model and the capture date are there too.
Check a file in the browser
You can scan for these markers in JavaScript:
const bytes = new Uint8Array(await file.arrayBuffer()); function hasExif(bytes) { const limit = Math.min(bytes.length - 6, 65536); for (let i = 0; i < limit; i++) { if (bytes[i] === 0xFF && bytes[i + 1] === 0xE1 && bytes[i + 4] === 0x45 && bytes[i + 5] === 0x78 && bytes[i + 6] === 0x69 && bytes[i + 7] === 0x66) { return true; // "Exif" } } return false; } Metadata segments come near the start of the file, so scanning the first 64 KB is enough. This is a quick check, not a full parser. A string search for GPS tells you if location tags may be present.
Strip it by redrawing
The easiest way to remove everything is to not copy it. Draw the image onto a canvas and export a new file. The canvas holds only pixels.
const img = await createImageBitmap(file); const canvas = document.createElement("canvas"); canvas.width = img.width; canvas.height = img.height; canvas.getContext("2d").drawImage(img, 0, 0); canvas.toBlob(blob => download(blob), "image/jpeg", 0.95); The new file has no EXIF, no GPS, no XMP and no ICC profile. Nothing leaves your device, because it all runs in the page.
Trade-offs
Re-encoding a JPEG loses a little quality. Setting quality to 0.95 keeps it close to the original, but the file is not byte-identical.
Dropping the ICC profile can shift colours a little on wide-gamut images.
Orientation is the other catch. Phones often store a rotation flag in EXIF, and the canvas does not keep it. Test on one portrait photo before you process a batch, and check it is still upright.
Verify
Open the result in any EXIF viewer, or run the same scan on the output. The markers should be gone.
A ready tool
AllTools has a remove-EXIF page that follows this method. It scans first and shows which kinds of data it found (GPS, camera, date, software), then redraws the image on a canvas. JPEGs stay JPEG, or you can pick PNG. It runs in your browser.
