Definition:
JPG or JPEG is a raster image format used mainly for photographs and scenes with many colours and tonal variations. Its file extension may be .jpg or .jpeg, and its usual MIME type is image/jpeg.
Most JPEG files use lossy compression: they reduce file size by discarding some visual information. The result can retain a suitable appearance with less data, but it depends on the image and the selected quality level. Conventional JPEG does not support an alpha channel for transparency or animation.
JPG and JPEG
JPG and JPEG identify the same format and do not provide different quality or compression. The .jpg extension became common because older file systems limited extensions to three characters, whereas .jpeg retains all four letters of the acronym. Current software and browsers generally recognise both extensions in the same way.
The name comes from the Joint Photographic Experts Group, the committee that developed the standard. JPEG is therefore the acronym of the group and the name commonly used for its family of image coding techniques.
JPEG compression
In its most widespread form, JPEG transforms the image data, separates brightness and colour components and divides the content into blocks. It then quantises this data to reduce details that may be less perceptible before encoding the result. Quantisation is the stage that introduces information loss and makes the file smaller.
The JPEG 1 standard includes several coding modes, although lossy compression is the form most commonly used for photographs and web pages. A lower quality setting usually creates a smaller file, but it can also produce blocking, halos or loss of detail, particularly around text, sharp edges and smooth gradients.
Repeatedly editing and saving a JPG can accumulate degradation, because each new compression may discard more information. When an image will go through several editing stages, it is preferable to retain a higher-quality original and generate the final JPG from it.
JPG characteristics
The format is particularly useful when broad compatibility and a contained file size are required for a still image. Its main characteristics include:
- Suitability for photographs: It represents images with many tones, textures and colour transitions effectively.
- Configurable compression: It allows file size and quality to be balanced during export, without a universal setting that suits every image.
- Broad compatibility: Browsers, cameras, operating systems, editing applications and digital platforms recognise it.
- No transparency or animation: Conventional JPG does not include an alpha channel or a sequence of frames.
- Metadata: It can contain EXIF information such as date, camera, orientation or location, which may need review before publication or sharing.
- Progressive loading: A progressive JPEG can display successive versions while it downloads, although the finished image contains the same encoded visual data.
It is not the most suitable choice for logos, text-heavy screenshots, diagrams or illustrations with sharp edges, as compression may introduce visible artefacts. A lossless format or one designed for graphics and transparency is usually more appropriate in those cases.
JPG alternatives
The choice depends on the image, required quality, compatibility and intended use. Common alternatives include:
- PNG: It uses lossless compression and supports transparency. It is often suitable for interfaces, screenshots, graphics and sharp-edged elements, although photographs may be larger than their JPG equivalents.
- GIF: It uses a limited palette and can store simple animations. The GIF entry explains its uses and limitations compared with other formats.
- WebP and AVIF: They support features such as transparency and can produce smaller files than JPEG at comparable visual quality, although compatibility and fallbacks should be considered where necessary.
- HEIF or HEIC: HEIF is a high-efficiency container, while HEIC is an extension commonly used for images encoded with HEVC, particularly on mobile devices.
- TIFF and RAW: They are used in capture, editing, archival or print workflows where preserving information matters more than minimising file size.
- BMP: Its most common variants store bitmaps with little or no compression and produce large files, so it is rarely an efficient choice for the web.
JPG remains a practical option for still photographs when compatibility is the priority, while PNG, WebP, AVIF or other formats may be preferable when transparency, greater efficiency or precise reproduction of graphics is required.
Optimising JPG images
Optimising a JPG means adapting the file to its actual use rather than meeting a fixed size for every case. The following practices help manage visual quality and transfer size:
- Adjust the dimensions: Exporting an image at a size that matches its display area avoids delivering unnecessary pixels.
- Choose quality by inspection: Comparing several exports helps identify the lowest setting that does not introduce unacceptable defects in that image.
- Avoid recompression: Working from the original file reduces the accumulated loss caused by saving successive JPG versions.
- Review metadata: Removing unnecessary EXIF information can reduce file size and prevent sensitive data, such as a location, from being shared.
- Prepare responsive sizes: On a web page,
srcsetandsizescan deliver different dimensions according to the screen and pixel density. - Compare formats: WebP or AVIF may reduce transfer size, but they should be assessed against the required quality, support and publishing workflow.
An appropriate file size depends on dimensions, content, visual quality and loading context. A single maximum figure cannot replace reviewing the final file and measuring page performance.
