JPG Files: What They Are and When to Use Them

Detail of workspace of a start up
Cavan Images/Iconica/Getty Images

JPG files, also known as JPEGs, are a common file format used primarily for digital photographs and other complex still images. JPG is pronounced "jay-peg" and stands for Joint Photographic Experts Group, the committee that created the file type.

JPG files have the file extension .jpg or .jpeg and are, in fact also called JPEGs. They are the most common file type for images taken with digital cameras and are widely used for photos and other graphics used on websites.

About JPG's Lossy Compression

When JPG files are saved, they use a "lossy" compression, meaning that image quality is lost as file size decreases. When web designers put together a web page that contains photographs, they choose the level of compression for a JPG file: the more compression, the faster the image loads and the better the user's experience with the page — but as the compression increases, image quality is lost.

This means that web designers are constantly weighing image crispness and detail against page loading times. If you have viewed a JPG saved with very high compression, you might have noticed jagged pixels instead of smooth gradations between colors.

JPGs can, however, withstand up to 15 percent file size without any visual quality loss.

When the JPG Format Works Best

A JPG can display millions of colors in a 16-bit data format and is the format used most often by digital cameras.

It's great for photos because it elegantly handles color gradation, unlike another common file format, the GIF. It supports color formats CMYK, RGB and Grayscale. 

In addition to photographs, JPGs are bested used for still images, images that have complicated shades or light and dark, or complex colors.

JPGs are not as well suited for or images that feature line drawings or those with simple shapes and colors such as icons or buttons. This is because these sharp edges can display with visible artifacts. In these cases, consider using a GIF or PNG instead, which uses a lossless graphics format (in which no image data is discarded).

Further, a JPG does not preserve transparency. If you need a transparent background, choose a PNG instead. 

Working with JPGs

When you create JPGs from a graphics program, always save the original program's file in its native format. For example, if you are using GIMP or Photoshop, retain the original file in those formats, while created a copy as a JPG for use on the web or elsewhere. Again, this is due to JPG's lossy compression type: once image data is discarded, it can never be recovered. 

Similarly, once you download images from your camera, save a copy at their original size. While they are already JPGs (in most cases), they are usually at a very high resolution which means that they have a high number of pixels per square inch, providing them with lots of color data. For emailing or uploading to a website, you'll want to save them as a smaller size — but again, always save the original unless you are sure you will never need to print the photo or take advantage of its original, higher resolution.