AVIF file format
AV1 Image File Format, a modern still-image format based on the AV1 video codec.
- MIME type
- image/avif
- Extensions
- .avif
- Category
- Images
Magic-number signature
| 0x00000004 | 66747970 | ftyp | ISO-BMFF 'ftyp' box |
| 0x00000008 | 61766966 | avif | brand 'avif' |
About the AVIF format
AVIF applies the AV1 video codec to still images, delivering excellent compression with HDR and wide-gamut support. Like MP4 it is an ISO-BMFF file: an 'ftyp' box at offset 4 carrying the brand 'avif'. Nothing in an ISO-BMFF file has a fixed position beyond that first box, because the format is a tree of boxes that each begin with their own size and four-character type. An AVIF's picture is stored as an item inside a 'meta' box rather than as a track, which is exactly what separates a still image from the video files that share the container.
Header layout, byte by byte
| Offset | Length | Field | Meaning |
|---|---|---|---|
| 0 | 4 | ftyp box size | Big-endian length of the file-type box including these four bytes, commonly 00 00 00 18 — twenty-four — for a brand plus two compatible brands. Every ISO-BMFF number is big-endian, unlike the RIFF formats. A size of 1 means a 64-bit length follows the type, and a size of 0 means the box runs to the end of the file. |
| 4 | 4 | Box type | 66 74 79 70, the ASCII letters ftyp. The file-type box is required to be first, which is what makes offset 4 a dependable place to look even though nothing else in the format sits at a fixed position. This is the byte range shared by AVIF, HEIC, HEIF, MP4, MOV and 3GP alike. |
| 8 | 4 | Major brand | 61 76 69 66 for a still image. Image sequences and animated AVIF use 61 76 69 73 — avis — instead, so an animation and a still differ by one byte here and by a great deal in how they must be decoded. |
| 12 | 4 | Minor version | An informational number with no effect on parsing, almost always 00 00 00 00. It is not a version of the brand and no reader is permitted to reject a file over it. |
| 16 | variable | Compatible brands | Four bytes each, filling whatever remains of the box, so a 24-byte ftyp holds exactly two. A file produced by macOS lists avif and mif1; a file from a web encoder often adds miaf and a coding-constraint brand such as MA1B. A reader may open the file if it recognises any brand in this list, which is why the major brand alone is not decisive. |
| 24 | 4 | Next box size | Immediately after a 24-byte ftyp, the next box header begins. Boxes are walked by adding each size to the current position, so a single wrong size here loses the rest of the file — there is no resynchronisation mechanism anywhere in ISO-BMFF. |
| 28 | 4 | Next box type | Usually 6D 65 74 61 — meta — the box that holds the item list, item properties and item locations that make this a still-image file. Finding trak boxes instead means the file is really video, whatever the extension says. |
Telling it apart from its neighbours
| Easily confused with | How to tell |
|---|---|
| HEIC | Same container, same first eight bytes, and the decision is entirely the four bytes at offset 8: 61 76 69 66 is AV1-coded, 68 65 69 63 is HEVC-coded. The practical consequence is licensing rather than structure — every current browser decodes AVIF and none but Safari decodes HEIC — and no amount of remuxing converts one to the other, since the compressed image data is a different codec. |
| HEIF | Harder than it looks, because AVIF files list mif1 among their compatible brands. A macOS-produced AVIF has avif at offset 8 and mif1 at offset 20, so a detector matching mif1 anywhere in the ftyp box will call it HEIF. Only the major brand at offset 8 settles which format the file primarily claims to be. |
| MP4 | Offset 4 is identical and the brand at offset 8 is the only thing that differs: isom, mp42, avc1 or dash for video, avif or avis for images. The deeper test is structural — a still image stores its picture as an item under a meta box, while video stores samples described by trak boxes — and an avis sequence blurs the line deliberately. |
| WebP | 52 49 46 46 against a four-byte box length, so there is no confusion at byte level. They compete for the same slot in a picture element, and the trade is consistent: AVIF is typically twenty to fifty percent smaller than WebP at matching quality, and takes an order of magnitude longer to encode. |
How these files break
- Truncation. The meta box carrying dimensions and item properties normally sits near the front, so a decoder happily reports the image size and then finds no pixels — or only the first tile of a tiled image — because the mdat box was cut off. An intact AVIF's final box ends exactly at the end of the file, which is what to check.
- A wrong box size. Boxes are walked by adding sizes, so one bad length lands the parser in the middle of another box's payload and it reads four arbitrary bytes as a type. Every box after the damage is lost even though the bytes are all present, and errors from this look like a completely unrelated box being malformed.
- An image sequence saved as a still. A file branded avis contains multiple frames, and software that only implements still AVIF renders the first one and reports success. Nothing is damaged; the other frames simply never appear, and the file size looks inexplicably large for the picture shown.
- Missing or wrong colour properties. AVIF carries its colour primaries, transfer function and matrix as item properties, and a converter that drops them leaves the decoder guessing. An HDR image then renders as washed-out or oversaturated SDR while remaining structurally valid, which is why an AVIF can look wrong in one browser and right in another.
- Software too old for the file. AVIF arrived in browsers between 2020 and 2022, and a great deal of desktop and server software still cannot decode it. A file that opens in Chrome and fails everywhere else is usually not corrupt at all — checking that offset 4 reads ftyp and offset 8 reads avif is enough to rule damage out.
Where the format stands today
AVIF is the best-compressing image format with genuinely broad browser support, available in Chrome since 2020, Firefox since 2021 and Safari since 2022, and it is the right default for photographic content on a site that already serves a picture element with fallbacks. Against JPEG it typically saves half the bytes at matching quality; against WebP, twenty to fifty percent. It also brings capabilities the older formats simply lack: ten and twelve bits per channel, HDR transfer functions, wide colour gamuts, film grain synthesis, alpha and animation, all in one container. The cost is encoding time, which runs one to two orders of magnitude above JPEG and makes it a build-step or CDN format rather than something a phone or a browser upload path produces on the fly. Support outside browsers is still patchy — plenty of desktop editors, email clients and older Android versions cannot open one — so it is not yet a safe format to hand someone as a file. The sensible arrangement, and the one most large sites now run, is AVIF first in the picture element, WebP second and JPEG last.
Open AVIF files on this site
Every one of these runs in your browser — the file never leaves your machine.
Related formats
Formats that are easy to confuse with AVIF — compare their leading bytes.