Loading Image to Base64 Converter...

How to Convert AVIF to Base64 - Step by Step Guide

Step 1

Upload Your AVIF Image

Start with your AVIF image file. Click the "Upload" button or drag the file onto the left panel. AVIF compresses well, which keeps the Base64 string shorter than it would be for the same picture as a PNG or JPEG.

•
Click to upload: Use the "Upload" button to pick an AVIF file from your computer
•
Drag and drop: Drop the file straight onto the left panel
•
Try the sample: "Sample" loads a small PNG test image so you can see the output before using your own AVIF
•
Size limit: Files up to 10 MB are accepted
•
Stays on your device: The file is read by your browser and is not uploaded or kept anywhere
Step 2

Check the Preview and the Output

As soon as the file is read you get a Base64 encoded string on the right and a preview of the image on the left, with its file size and the format detected from the file itself.

•
No button to press: Encoding starts by itself once you pick a file
•
Real format check: If the file is actually a PNG or JPEG with an .avif name, you'll see a note with the correct data URI prefix
•
Clean Base64 output: Just the Base64 characters, without a data URI prefix
•
Local processing: Everything runs in the browser FileReader API, so the image never leaves your device

Understanding Base64 Encoding

When your AVIF is converted to Base64:

→
Binary to text: every 3 bytes of the AVIF file become 4 characters from the RFC 4648 alphabet
→
Size increase: the text is about 33% larger than the file
→
Text-safe: the string can travel through JSON, HTML or email without being mangled
Step 3

Copy or Download Your Base64 String

Click "Copy" to put the Base64 string on your clipboard, or "Download" to save it as a text file. Both give you exactly what is shown in the editor.

•
One-click copy: "Copy" copies the whole Base64 string
•
Download as file: Saves the string as a .txt file named after your image
•
Use in HTML: Embed directly in <img src="data:image/avif;base64,..."> tags
•
CSS backgrounds: Use in CSS background-image properties to save an extra request for small images
•
Convert more: Use the "Remove" button to clear the panel and pick another image

What is AVIF to Base64 Conversion?

AVIF to Base64 conversion is the process of encoding an AVIF (AV1 Image File Format) image file into a Base64 text string. AVIF is a modern image format based on the AV1 video codec. It usually compresses better than JPEG and PNG, and supports HDR, wide color gamut, and transparency.

The Base64 encoding scheme transforms binary AVIF data into ASCII text using a set of 64 characters (A-Z, a-z, 0-9, +, /), making it possible to embed AVIF images directly in text-based formats like HTML, CSS, and JSON. This page does the conversion locally in your browser using the FileReader API, so the image is never sent to a server.

How AVIF to Base64 Encoding Works

When you convert an AVIF image to Base64, the binary data of the image file is read and transformed into a text representation. The browser's FileReader API reads the file as a data URL, and the tool keeps only the Base64 part after the comma.

The resulting Base64 string can be used directly in HTML <img> tags as a data URI, or in CSS background-image properties. Because AVIF files tend to be small, they are a reasonable fit for inlining.

Base64 encoding increases the size by about 33%. The encoded string is plain text, so it works anywhere text does, including JSON APIs, XML documents, and MIME email.

Frequently Asked Questions

How do I convert an AVIF image to Base64?

Click Upload and pick your .avif file, or drag it onto the left panel. The Base64 string shows up on the right as soon as the file is read, and you can copy it or download it as a .txt file. To go the other way, paste the string into Base64 to AVIF or Base64 to Image.

Is the Base64 exactly the same file, or is the image re-encoded?

It is the same file. The tool reads the raw bytes of your AVIF and encodes them as they are, so decoding the string gives you back a byte-for-byte copy. Nothing is resized, recompressed or converted, which also means HDR data, colour profiles and transparency stay in the file.

Is my AVIF image uploaded anywhere?

No. The file is read by your browser with the FileReader API and the Base64 is built on your own machine. Nothing is sent to our server and nothing is kept, so reloading the page starts empty again.

Does the tool include the data URI prefix?

No, you get the plain Base64 string. For HTML or CSS, put data:image/avif;base64, in front of it, for example <img src="data:image/avif;base64,YOUR_STRING">. If the file turns out to be a different format than its name suggests (a PNG renamed to .avif, say), the tool tells you and shows which prefix to use instead.

What happens if I pick a file that is not really an AVIF?

The tool checks the first bytes of the file, not just its name. A real image in another format is still encoded and labelled with its true type, with a note about the right data URI prefix. A text file, PDF or archive renamed to .avif is refused with a short explanation, and an empty file is reported as empty.

How big can the AVIF file be?

Up to 10 MB. Keep in mind that Base64 is about a third larger than the file itself, so a 3 MB AVIF becomes roughly 4 MB of text. For anything that large, a normal image URL is usually a better choice than inlining it.

Which browsers can display a Base64 AVIF?

Chrome 85+, Firefox 93+, Opera 71+ and Safari 16.4+ all show AVIF. If you need to support older browsers, wrap the image in a <picture> element and add a WebP or JPEG fallback.

How do I use the Base64 AVIF in CSS?

Use it inside url(), like background-image: url(data:image/avif;base64,YOUR_STRING);. Small icons and placeholders work well this way; big photos make your stylesheet heavy and can no longer be cached separately.

Need to turn a string back into a picture? Try Base64 to AVIF or Base64 to Image. For files that aren't images, use File to Base64.