JPG shines for photos because lossy compression keeps file sizes small. PNG excels for graphics with flat colors, sharp text, or transparency.

Pick JPG when: you need smaller files, mild artifacts are acceptable, and there is no transparency. Pick PNG when: you need crisp edges, transparency layers, or lossless quality.

For modern browsers, WebP can combine the best of both—try it if your pipeline supports it.