What is the JPG file format?
Files with the .jpg extension are compressed raster image files stored in JPEG format (Joint Photographic Experts Group). The .jpg extension is used interchangeably with .jpeg - the three-letter form dates from the DOS and early Windows era, when file extensions were limited to three characters.
JPEG uses a lossy compression method based on discrete cosine transform (DCT), which means that when saving a file, some image data is permanently discarded. The JPEG standard was the first widely adopted format to let users control the compression level - and therefore the trade-off between file size and image quality.
Advantages of JPG
The biggest advantage of .jpg files is their small size, which makes them ideal for sharing and storing images on virtually any device. Most digital cameras and smartphones save photos in this format by default. JPEG remains the most widely used image file format on the web, though newer formats such as .webp and .jxl offer better compression ratios at comparable quality.
The two most common interchange variants are .jfif - the original web-friendly container - and Exif, used by cameras and phones to embed metadata such as shooting date, GPS coordinates and exposure settings. Every valid JPEG file starts with the magic bytes FF D8 FF and ends with FF D9.
Opening .jpg files
.jpg files are supported by virtually every image viewer, web browser and professional graphics application available today.
Security & safety
RISK: LOWJPG is a passive data format - it cannot execute code, so a normal photo is safe to open. Two caveats worth knowing: (1) Exif metadata can embed GPS coordinates and camera info, so photos shared publicly may leak your location - strip Exif before posting if that matters. (2) Historically, a handful of image-parser vulnerabilities (e.g. the 2004 Windows GDI+ JPEG flaw) let crafted JPGs exploit unpatched viewers; keep your OS/viewer updated. A file claiming to be a 'photo.jpg' that is actually 'photo.jpg.exe' is the real danger - check the true extension.
Format details
in a nutshellPrograms that open JPG files
Technical details
deep spec| Compression algorithm | Discrete Cosine Transform (DCT), lossy |
| DCT block size | 8×8 pixel blocks |
| Chroma subsampling | 4:2:0 (most common for photos), 4:2:2, or 4:4:4 |
| Bit depth | 8 bits per channel (24-bit color standard); 12-bit defined in spec |
| Color spaces | YCbCr (default), grayscale, CMYK, RGB |
| Quality scale | 1-100 (implementation-defined; 75-85 typical for web delivery) |
| Maximum dimensions | 65,535 × 65,535 pixels |
| Magic bytes | FF D8 FF (Start Of Image); file ends with FF D9 (End Of Image) |
| MIME type | image/jpeg |
| Interchange variants | JFIF (ISO/IEC 10918-5, web/generic) and Exif 2.x (cameras and smartphones) |
| Metadata support | Exif (GPS, exposure, thumbnails), IPTC, XMP, ICC color profiles |
| Progressive encoding | Supported; image loads in successive detail passes rather than top-to-bottom |
| Transparency support | Not supported; no alpha channel |
| Lossless rotation | Possible via DCT coefficient manipulation (e.g., `jpegtran`) without full re-encode |
| Extension aliases | .jpg, .jpeg, .jpe, .jfif - all identify the same format |
| Released | 1992 (JPEG standard, ISO/IEC 10918-1); JFIF interchange format 1992 |
| Open standard | Yes · royalty-free |
| Specification | www.w3.org |
JPG conversions
Community Q&A
asked by usersNo questions yet - be the first to ask about JPG files.