Choosing JPEG, GIF or PNG for web images
Keep an editable master and produce separate files for the website. The best export depends on the image: a photograph, a small diagram and a transparent button place different demands on compression and colour.
Use JPEG for continuous-tone pictures
Photographs usually compress well as JPEG. Resize to the required pixel dimensions before choosing the quality setting, and inspect faces, edges and areas of fine texture. Repeatedly opening and saving a JPEG introduces further loss, so regenerate exports from the master. Sharp lettering and flat-colour diagrams often develop visible artefacts around their edges.
Use a palette deliberately
GIF supports a palette of up to 256 colours and a transparent palette entry. It suits small flat-colour artwork when that palette is sufficient. Reduce unnecessary colours and inspect the result rather than assuming the smallest export is acceptable. Dithering can imitate extra colours but adds visible texture, and can make large areas harder to compress.
Test PNG in the browsers you support
PNG provides lossless compression, including true-colour images and alpha transparency. Its format capabilities do not guarantee identical rendering in the browsers currently in use. Test transparency against the actual page background in each supported browser. Where that fails, export artwork against a fixed background or use a suitable GIF version; keep the original so another export remains possible.
Set image dimensions in the HTML so space can be reserved during loading, provide useful alternative text and compare total page weight over the connection speed your visitors actually use.