JPG to GIF Converter

What this conversion always does
  • The picture is mapped onto at most 256 colours, so smooth gradients break into bands or dither patterns. A picture that already uses 256 or fewer keeps every one exactly.
  • The Exif data, the colour profile and anything else the original carried are not passed on: the picture is decoded to plain pixels and a new file is written from them.
What this page reads and writes
  • Writes at most 256 colours and one clear entry, and refuses a picture larger than 16,000,000 pixels.

Needs JavaScript. Runs only here.

Swap to GIF to JPG

This page turns a JPG into a GIF on your own machine. Every conversion on this page runs in your browser. The picture is read, drawn and written on your own machine, and the file is not sent to a server.

Going the other way? Convert GIF back to JPG

How do you convert a JPG to a GIF?

A JPG photograph can use millions of colours. A GIF can use 256, so converting maps the photograph onto a palette chosen from its own colours and dithers the difference.

In short

A JPG converted to GIF is mapped onto a palette of at most 256 colours. A photograph holds far more than that, so by default the result is dithered and usually looks grainier than the JPG. Flat graphics fare better.

  1. Choose the JPG file you want to convert. It is read inside this page, on your own machine.
  2. Leave dithering on for photographs and gradients, or turn it off for flat graphics. A picture with 256 colours or fewer keeps every colour either way.
  3. Select Convert to GIF. The palette is chosen and the file is written by this page, in your browser, because no browser has a GIF writer of its own.
  4. Download the GIF. Nothing has been sent anywhere, so the file is ready as soon as it is written.

JPG to GIF puts a photograph on a palette of limited colours, so for a format that keeps every shade, see the picture format converter.

What Changes From JPG to GIF

JPG to GIF maps a photograph onto at most 256 colours. A photograph holds far more than that, so by default the result is dithered and usually looks grainier than the JPG; flat graphics fare better.

Each row below is one property of the picture: what it is in the JPG, what it becomes in the GIF, and whether it survives the trip. Convert a file and the same rows fill in with the measurements from your own picture.

What Changes From JPG to GIF
Property In the JPG In the GIF Verdict
Dimensions as the file has them as the file has them kept
Colour model and bit depth Y'CbCr, 8 bits per channel palette indices, at most 256 colours; each colour in the table is 8 bits per channel changed
Alpha channel none none kept
Colours used up to 16,777,216 at most 256; a picture with 256 or fewer keeps every one lost
Animation frames 1 1 kept
Metadata (Exif, ICC) present in the file dropped — a new file is written from pixels lost
Compression lossy, discrete cosine transform (the baseline process) variable-length-code LZW over palette indices changed
File size the file you chose depends on the picture — both sizes print once you convert changed

the pixels survive; the colours beyond the palette and the Exif data do not.

Going Back to JPG

Converting back does not restore what this step dropped, so convert the GIF result back to JPG only when you need a JPG file.

The change above runs one way — go back from GIF to JPG writes a new file, not the original.

What Travels With the Picture

What the two formats are, and what the browser does with a picture on the way between them. None of this depends on which JPG you bring.

How JPG and GIF Are Defined

How JPG and GIF Are Defined
Property JPGGIF
Compression lossy, discrete cosine transform (the baseline sequential process); the standard also defines a separate lossless mode that web .jpg files do not usevariable-length-code LZW over palette indices; the coding step is exactly invertible, so nothing is lost after the picture has been reduced to the palette
Alpha channel none - neither T.81 nor JFIF defines an alpha or transparency channelnone - one palette entry may be marked transparent and is skipped when drawn
Animation none - one image per fileyes - several images in one data stream, each preceded by a Graphic Control Extension whose Delay Time is in hundredths of a second. Looping is not part of the specification.
In one sentence JPEG saves space by throwing detail away. The baseline process, which is what a .jpg file on the web uses, is lossy and cannot be undone, and the standard defines no transparency at all.A GIF draws every pixel from a colour table of at most 256 entries. Transparency is one of those entries marked clear, so a pixel is either wholly transparent or wholly opaque.
  • A JPG file begins FF D8 (SOI); a JFIF file follows it with FF E0 and the identifier 4A 46 49 46 00.
  • A GIF file begins 47 49 46 38 39 61 ("GIF89a") or 47 49 46 38 37 61 ("GIF87a").
  • JPEG is defined by ITU-T Rec. T.81 | ISO/IEC 10918-1 (JPEG); ITU-T Rec. T.871 | ISO/IEC 10918-5 (JFIF).
  • GIF is defined by Graphics Interchange Format Version 89a (CompuServe, 1990).

JPEG and lossy WebP save space by discarding picture detail, and what they discard does not come back. PNG, BMP and lossless WebP keep every pixel they are given, and GIF keeps every pixel it is left with after the palette has been applied.

A GIF holds at most 256 colours at a time. A picture with more than that is mapped onto the palette, which is why smooth gradients come out banded or dithered.

Converting a picture back to the format it came from does not return the original file. Whatever a step discarded stays discarded, and the return trip writes a third file.

The browser decodes the picture to plain pixels and writes a new file from them, so the Exif data, the colour profile and anything else the original carried are not passed on.

No browser writes GIF from a canvas. A GIF has to be built in JavaScript: the colours reduced to a palette, dithered where the picture needs it, and coded with LZW.

This site writes GIF files itself. A picture that uses 256 colours or fewer, counting one for transparency when any pixel is clear, keeps every colour exactly; a picture with more is reduced to 256 by median cut, which groups the colours where the picture has them and uses the average of each group.

Where the palette has to reduce a picture, this site spreads each pixel's colour error onto the pixels to its right and below it (Floyd-Steinberg dithering), which trades bands for fine grain. Dithering is on by default and can be switched off, and a picture that already fits the palette is never dithered.

This site refuses to write a GIF from a picture larger than 16,000,000 pixels, such as 4,000 x 4,000, and says so before decoding it, so that reducing the colours cannot lock up the browser tab.

When Is a GIF Worth It for a Photograph?

When nothing else is accepted

That is the usual reason. If the place a picture is going takes only GIF, the palette is the price of getting it in, and dithering is what keeps a photograph from breaking into bands of flat colour across the sky and the shadows.

When the picture is really a graphic

A screenshot, a chart or a logo saved as JPG has few true colours under the JPEG noise. The palette catches those, and turning dithering off keeps the flat areas flat.

Not for keeping a photograph

A GIF of a photograph is usually grainier than the JPG and often larger, and the colours the palette dropped do not come back. Keep the JPG as the copy you edit, share or print.

Common Mistakes

  • Expecting a photograph to look the same. At most 256 colours stand in for millions, so skin, sky and shadow pick up grain or bands.
  • Expecting a smaller file. Dithered pixels rarely repeat, and GIF compression works on repeats, so the GIF often outweighs the JPG.
  • Expecting a transparent background. A JPG has none to give, so every pixel of the GIF is opaque.

Frequently Asked Questions

Can a JPG be animated?

No. JPEG defines one picture per file and no frames, so one JPG becomes a GIF of one frame. An animated GIF is built from several pictures, which is a different job from this conversion.

What's the difference between JPG and GIF?

A JPG stores millions of colours and saves space by discarding detail. A GIF stores at most 256 colours at a time, loses nothing after that, can mark one colour clear and can hold an animation.

Why does a photograph look worse as a GIF?

Because the palette stands in for far more colours than it holds. Median cut picks the 256 that cover the photograph best and dithering scatters the rest as grain, but the missing shades are still missing.

Does converting a JPG to GIF make the file smaller?

Often not. Fewer colours help, but a dithered photograph has few repeated runs for GIF compression to use. Convert yours and the table prints both sizes.

You can, but the round trip is not the file you started from: the GIF to JPG direction.

The rest of the family sits on all the picture formats in one place.