One of the neat things about the World Wide Web is its ability to display pictures, movies, animations, etc. "in-line", which means "on a page at the same time as lots of other stuff." In the old days (the epoch of Gopher, FTP, and USENET) you'd need separate applications to view graphics. In today's browsers, several different formats are supported in-line, with the GIF and JPEG formats being the most common.
If GIF and JPEG are both supported by your browser, why use one over the other?
'Bot as a GIF
'Bot as a JPEG
In the table above, 'Bot is shown in the GIF format (on the left) and in the JPEG format (on the right). Depending on how many colors your monitor can display, you may see a difference in quality between the two. In general, a GIF will look worse than a JPEG because the GIF supports (at maximum) 256 colors. The JPEG can have thousands of colors.
Below each image is its size in kilobytes. The smaller the number, the quicker the picture is to download. You'll see that the JPEG is less than half the size of the GIF.
OK. So the JPEG looks better and downloads quicker than the GIF. Why even bother with the GIF Format? Well, there are some advantages to using a GIF, explained under these topic headings:
Transparency | Interlacing | Animation
In general, you'll probably want to use the JPEG for nice photographs, and the GIF for anything that needs to be interlaced, transparent, or animated. If you are in doubt, save your graphic in both formats, reducing the size of each one to an acceptable quality, and compare the size of each image. If there's no difference in quality, go with the smaller one!
A Little More Information... (if you're interested!)
The GIF format was pioneered by Compuserve (remember Compuserve?) as a format that could be read cross-platform. If you had a PC, you could download a graphic that was created on a Mac, or an Amiga, or an Atari. The GIF format uses the LZW compression scheme from Unisys, and in recent years this has caused a lot of fighting over licensing issues.
The 'regular' GIF format is also known as the 'GIF87' format. There is also a newer format, known as 'GIF89a', that allows us to do the transparency, interlacing, and animations. The earliest browsers did not support these features, but all of the new ones today should be fully compliant.
JPEG stands for "Joint Photographic Experts Group", the name of the group that first wrote the standard. Although earlier in this page we kept saying "the JPEG format", JPEG isn't really a graphical file format! We were lying (sorry.) JPEG is in fact a compression mechanism; the actual file format is JFIF ("JPEG File Interchange Format"). Don't worry, though; whenever someone says "JPEG file" they mean "JFIF" so you can just go on calling it a JPEG... everybody else does.