ByteScope

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

0x0000000466747970ftypISO-BMFF 'ftyp' box
0x0000000861766966avifbrand '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

OffsetLengthFieldMeaning
04ftyp box sizeBig-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.
44Box type66 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.
84Major brand61 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.
124Minor versionAn 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.
16variableCompatible brandsFour 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.
244Next box sizeImmediately 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.
284Next box typeUsually 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 withHow to tell
HEICSame 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.
HEIFHarder 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.
MP4Offset 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.
WebP52 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.

FormatFirst bytesExtension
HEIC66 74 79 70.heic
WebP52 49 46 46.webp
JPEGFF D8 FF.jpg
MP466 74 79 70.mp4

Frequently asked questions

What is a magic number in a file?

The first few bytes of a file, which identify its format regardless of what the name says. A PNG always starts with 89 50 4E 47; a ZIP with 50 4B 03 04. Operating systems, browsers and the file command all read these bytes rather than trusting the extension, which is why renaming a file does not change what it actually is.

How do I check a file's magic number myself?

On macOS or Linux, xxd -l 16 yourfile prints the first 16 bytes; on Windows, Format-Hex -Path yourfile -Count 16 in PowerShell. Or drop the file into the File Type Identifier on this site, which reads the bytes locally and names the format for you — nothing is uploaded.

Why do two formats share the same magic number?

Because one is built on the other. Every docx, xlsx, pptx, apk, jar and epub begins with the ZIP signature, since all of them are ZIP archives underneath; telling them apart means looking at the entries inside. Java class files and macOS universal binaries both start with CA FE BA BE and are distinguished by the field that follows.

Can a file have no magic number at all?

Yes. Text-based formats — XML, HTML, JSON, SVG, CSV — have no fixed byte signature, so they are recognized structurally instead: a leading <?xml declaration, a <svg element, or a { followed by a quoted key. That detection is a good guess rather than a certainty, which is why this reference marks those formats as probe-detected.

Does a matching magic number mean the file is safe?

No. It tells you what the format is, not whether the contents are harmless — a genuine PDF or docx can still carry a malicious payload. Identifying the true type is a useful first check, especially when the extension disagrees with the bytes, but it is not a malware scan.

Have a file that might be in the AVIF format? Identify it with the File Type Identifier — it reads the magic number locally, nothing is uploaded. Or browse all formats.