Your browser’s own encoders save the same pixels as PNG and as JPG at five qualities, then decode them again. The page reports the real byte counts and PSNR (peak signal-to-noise ratio, where 40 dB and above is usually indistinguishable). Pictures with transparency are compared over white, since JPG cannot store alpha.
Because JPG discards data, it produces much smaller files for continuous-tone images like photographs. PNG produces smaller files for flat colour, sharp edges and text, where its prediction filters find strong redundancy and JPG’s block transform introduces visible artifacts.
JPG dominates photographs and natural images, including camera output and most photos on the web. PNG is used where transparency, sharp edges or exact reproduction matter: logos, icons, screenshots, line art, and images composited over varied backgrounds. Many workflows keep a lossless master and export a JPG copy for distribution.
Use JPG for photographs and complex images. Use PNG for logos, screenshots, icons, or anything needing transparency.
Yes, PNG fully supports alpha channel transparency. JPG does not support transparency at all.
JPG is better for photos (smaller files). PNG is necessary for transparent graphics. WebP is ideal for both.
No, converting JPG to PNG cannot recover quality already lost during JPG compression.
PNG is generally better for printing graphics and logos. For photographs, either works well at high resolution.