Add a Secret JPG Comment
Embed hidden text comments into JPEG files using the COM marker. Read, add, or replace secret metadata comments in any JPG image.
About
Every JPEG file supports an invisible text payload called the COM (Comment) marker, defined by the marker code 0xFFFE in the JPEG specification (ITU-T T.81, Annex B). Most image viewers and social media platforms silently strip these markers, which means any comment you embed survives only in the raw file. This tool performs direct binary injection into the JPEG byte stream without re-encoding, so pixel data remains bit-identical to the original. The maximum payload per COM segment is 65,533 bytes (216 − 3). Attempting to store comments in lossy re-encoding workflows destroys quality. This tool does not.
Common use cases include watermarking provenance (photographer name, license), embedding machine-readable tags for archival pipelines, or simply hiding a message for someone who knows where to look. Note: this is not encryption. Anyone with a hex editor or this tool can read the comment. If you need secrecy, encrypt your message before embedding. The tool also reads and displays any existing COM markers already present in the file, which is useful for forensic inspection of image origin.
Formulas
The COM marker segment follows the standard JPEG marker format. The binary layout of a COM segment is:
Where L is a 16-bit big-endian unsigned integer representing the segment length (including the 2 length bytes themselves but excluding the marker bytes). The relationship between comment byte length and segment length is:
Where n is the number of bytes in the UTF-8 encoded comment string and L is the value written into the length field. The maximum value of L is 216 − 1 = 65,535, therefore the maximum comment payload n = 65,535 − 2 = 65,533 bytes. The injection offset is always byte position 2 (immediately after the SOI marker 0xFFD8). The total file size increase equals n + 4 bytes (marker + length + payload).
Reference Data
| JPEG Marker | Hex Code | Name | Description | Max Payload |
|---|---|---|---|---|
| SOI | 0xFFD8 | Start of Image | First 2 bytes of every valid JPEG | 0 bytes |
| APP0 | 0xFFE0 | JFIF Header | JFIF format identifier and thumbnail | 65,533 bytes |
| APP1 | 0xFFE1 | EXIF / XMP | Camera metadata, GPS, orientation | 65,533 bytes |
| APP2 | 0xFFE2 | ICC Profile | Color space profile embedding | 65,533 bytes |
| APP13 | 0xFFED | IPTC / Photoshop | Caption, keywords, copyright (legacy) | 65,533 bytes |
| APP14 | 0xFFEE | Adobe | Adobe color transform flag | 65,533 bytes |
| COM | 0xFFFE | Comment | Arbitrary UTF-8 text payload (this tool) | 65,533 bytes |
| DQT | 0xFFDB | Quantization Table | Defines compression quality matrices | 65,533 bytes |
| SOF0 | 0xFFC0 | Start of Frame (Baseline) | Image dimensions, bit depth, components | 65,533 bytes |
| SOF2 | 0xFFC2 | Start of Frame (Progressive) | Progressive scan image parameters | 65,533 bytes |
| DHT | 0xFFC4 | Huffman Table | Entropy coding table definitions | 65,533 bytes |
| SOS | 0xFFDA | Start of Scan | Begins compressed image data stream | Variable |
| EOI | 0xFFD9 | End of Image | Last 2 bytes of every valid JPEG | 0 bytes |
| DRI | 0xFFDD | Restart Interval | Defines restart marker spacing | 4 bytes |
| RST0-RST7 | 0xFFD0 - 0xFFD7 | Restart Markers | Error recovery sync points in scan data | 0 bytes |