PNG to AVIF Converter

Convert Portable Network Graphics (PNG) images into next-generation AV1 Image File Format (AVIF) with superior compression efficiency, alpha transparency preservation, and instant downloads.

Choose a PNG image or drag & drop here Supports .png graphics with alpha transparency (Max 5MB)
Browser Processing & Maximum File Limits

All PNG parsing and AVIF container packaging run client-side and via the API. Maximum file size is 5MB per upload.

How to Convert PNG to AVIF Online

1

Upload PNG File or Paste Input

Drag and drop a .png image into the drop zone, or paste a Base64 PNG Data URI string.

2

Configure Conversion Settings

Adjust resolution scaling (1x to 4x), background matte fills, or custom dimension parameters.

3

Convert & Download

Click Convert to AVIF to process the image, then Download your AVIF file or copy the Data URI.

Tool Options

Next-Gen AV1 Image Encoding

Encode ultra-efficient AVIF images with advanced compression algorithms for next-generation web performance.

Custom Quality & Scaling Controls

Fine-tune compression levels and scaling factors while preserving fine edges, text, and gradients.

Production Web Ready

Download standalone .avif assets or copy HTML5 responsive snippets for modern browsers.

Your Data Privacy

Web Tool
Privacy-First Architecture
Most of our web tools process your data entirely in-browser. Where server processing is technically required, payloads are evaluated statelessly in-memory and are never stored, saved, or logged.
REST API
Stateless In-Memory Processing
When you use our API endpoints, your requests are processed strictly in-memory without persistent database storage, disk logging, or data retention.
Want to learn more about how we safeguard your information and infrastructure?
Read our full Privacy Policy for detailed security standards, data retention principles, and compliance guarantees.

What does the PNG to AVIF Converter do?

The PNG to AVIF Converter converts Portable Network Graphics (.png) raster images into AV1 Image File Format (.avif) containers. AVIF leverages the open AV1 video codec standard within an ISO Base Media File Format (ISOBMFF) architecture to provide up to 50% smaller file sizes than WebP and JPEG while preserving high dynamic range and full alpha channel transparency.

This utility validates PNG binary headers, parses intrinsic dimensions and bit depth from IHDR chunks, and packages image streams into compliant ISOBMFF AVIF containers with avif and mif1 major brands. It supports resolution scaling (1x to 4x), custom pixel dimensions, quality compression tuning, transparent alpha channel preservation, solid background compositing, and instant browser downloads.

Core Concepts

Understanding the binary structure of the AVIF container format:

  • ISOBMFF Box Structure (ftyp and meta): AVIF packages image payloads inside standardized ISO Base Media boxes. The ftyp (File Type Box) specifies avif and mif1 compatibility brands, while meta encapsulates item descriptors, item locations (iloc), primary item pointers (pitm), and item info (iinf).
  • Item Info Entry (infe) & Item Type (av01): Inside the item info list, the primary image entry specifies the item type as av01 indicating an AV1 image bitstream.
  • Spatial Extents (ispe) & Pixel Information (pixi): Inside the item property container (ipco), the ispe box defines the spatial width and height of the image canvas in pixels, while pixi defines the channel depth (8, 10, or 12 bits per channel).
  • Transparency & Alpha Auxiliary Items: AVIF natively supports alpha transparency channels through auxiliary image items, allowing transparent PNG icons and logos to be compressed into lightweight web assets.

How to use the tool?

  1. Upload or Paste PNG: Drop a .png file into the upload zone, click Browse File, or paste a Base64-encoded PNG Data URI into the editor. Click Load Sample to inspect a sample conversion.
  2. Configure Resolution Scale: Select from standard scale multipliers (1x, 2x Retina HD, 3x Ultra, 4x Print) or enter custom width and height pixel boundaries.
  3. Select AVIF Quality: Adjust compression quality between 50% (Compact Size), 70% (Balanced Web), 85% (High Quality), or 100% (Maximum Quality).
  4. Choose Background Fill: Select Transparent Alpha to retain transparency or choose Solid White, Dark Navy, or a Custom Color with hex code input.
  5. Convert & Download: Click Convert to AVIF. The tool generates a live preview, calculates the resulting byte size, and provides a direct Download button for the .avif file alongside HTML <picture> code and Base64 Data URIs.

Related Developer Utilities

Complementary image conversion tools on blueutils.com:

REST API Integration

blueutils.com provides a free REST API endpoint (POST https://blueutils.com/api/image/png-to-avif) for programmatic AVIF container generation.

API Request Parameters

Name Type Description Example
rawText String Required. Raw PNG Base64 string or Data URI (data:image/png;base64,...). "data:image/png;base64,iVBORw..."
options.scale Number Optional. Scaling factor multiplier (e.g. 1, 2, 3, 4). Defaults to 1. 2
options.quality Number Optional. Quality factor between 0.1 and 1.0. Defaults to 0.85. 0.85
options.bgColor String Optional. Background color fill ("transparent", hex string like "#FFFFFF"). Defaults to "transparent". "transparent"
options.width Number Optional. Explicit target width in pixels (overrides scale). 1200
options.height Number Optional. Explicit target height in pixels (overrides scale). 800

API Request Payload Examples

cURL

curl -X POST https://blueutils.com/api/image/png-to-avif \
  -H "Content-Type: application/json" \
  -d '{
    "rawText": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNk+M9Qz0AEYBxVSF+FAAhKDveksOjuAAAAAElFTkSuQmCC",
    "options": {
      "scale": 1,
      "quality": 0.85,
      "bgColor": "transparent"
    }
  }'

Python

import requests

url = "https://blueutils.com/api/image/png-to-avif"
payload = {
    "rawText": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNk+M9Qz0AEYBxVSF+FAAhKDveksOjuAAAAAElFTkSuQmCC",
    "options": {
        "scale": 1,
        "quality": 0.85,
        "bgColor": "transparent"
    }
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())

Java

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String jsonPayload = "{\"rawText\": \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNk+M9Qz0AEYBxVSF+FAAhKDveksOjuAAAAAElFTkSuQmCC\", \"options\": {\"scale\": 1, \"quality\": 0.85, \"bgColor\": \"transparent\"}}";
        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://blueutils.com/api/image/png-to-avif"))
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
            .build();
        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}

API Response Parameters

Name Type Description Example
isValid Boolean Indicates whether conversion succeeded. true
mimeType String MIME type of generated payload ("image/avif"). "image/avif"
originalFormat String MIME type of source image ("image/png"). "image/png"
dataUri String Complete AVIF Base64 Data URI. "data:image/avif;base64,AAAA..."
base64 String Pure Base64-encoded AVIF binary buffer string. "AAAAIGZ0..."
metadata Object Dimensions, aspect ratio, byte sizes, and container properties. { "originalWidth": 10, "targetWidth": 10, ... }
snippets Object HTML <picture>, CSS, and Markdown embed code snippets. { "html": "<picture>...", "markdown": "..." }

API Response Payload Examples

Success Response (HTTP 200 OK)

{
  "isValid": true,
  "mimeType": "image/avif",
  "originalFormat": "image/png",
  "dataUri": "data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAG1pZjFhdmlmAAA...",
  "base64": "AAAAIGZ0eXBhdmlmAAAAAG1pZjFhdmlmAAA...",
  "metadata": {
    "originalWidth": 10,
    "originalHeight": 10,
    "targetWidth": 10,
    "targetHeight": 10,
    "scale": 1,
    "quality": 0.85,
    "bgColor": "transparent",
    "bitDepth": 8,
    "colorType": "RGBA Truecolor with Alpha",
    "hasAlpha": true,
    "majorBrand": "avif",
    "containerFormat": "AV1 Image File Format (AVIF / ISOBMFF)",
    "aspectRatio": 1,
    "originalSizeBytes": 70,
    "avifSizeBytes": 194,
    "formattedSize": "194 B"
  },
  "snippets": {
    "html": "<picture>\n  <source srcset=\"data:image/avif;base64,...\" type=\"image/avif\" />\n  <img src=\"data:image/png;base64,...\" width=\"10\" height=\"10\" alt=\"Converted AVIF Image\" />\n</picture>",
    "css": "background-image: url(\"data:image/avif;base64,...\");",
    "markdown": "![Converted AVIF Image](data:image/avif;base64,...)"
  }
}

Validation Failure Response (HTTP 400 Bad Request)

{
  "isValid": false,
  "error": "Invalid format: Expected a valid Portable Network Graphics (.png) image file."
}

Rate Limit Exceeded Response (HTTP 429 Too Many Requests)

{
  "error": "API rate limit exceeded. Please wait or contact support@blueutils.com."
}

Why use an API to convert PNG to AVIF?

Integrating the PNG to AVIF API into asset optimization pipelines, CDNs, and build scripts provides several practical advantages:

  • Rapid Script Validation: Enables automated build and deployment pipelines to generate AVIF containers without compiling heavy native AV1 encoding toolchains.
  • Optimized Token Efficiency for AI Agents: LLMs struggle with constructing ISOBMFF atoms, box offset arithmetic, and AV1 descriptor boxes. Delegating container assembly to a deterministic API saves tokens and eliminates errors.
  • Deterministic Accuracy Without Hallucinations: Standard ISOBMFF parsers require strict byte offsets and aligned item tables. The API guarantees 100% specification compliance.

Native Usage

How to convert PNG images to AVIF format locally using native operating system utilities and standard libraries:

Windows (PowerShell)

On Windows, use avifenc (libavif) or ImageMagick via PowerShell:

# Using ImageMagick CLI on Windows
magick input.png -quality 85 output.avif

# Or using libavif CLI
avifenc -q 85 input.png output.avif
Write-Host "Converted input.png to output.avif successfully."

Linux / Unix (Bash)

On Linux/macOS systems, use avifenc (libavif standard) or ImageMagick:

# Using libavif encoder
avifenc --min 0 --max 63 -a end-usage=q -a cq-level=20 input.png output.avif

# Using ImageMagick CLI
magick input.png -quality 85 output.avif

Python

Wrap image payloads into an ISOBMFF AVIF container using the Python standard library:

import struct

def wrap_png_to_isobmff_avif(png_bytes: bytes, width: int, height: int) -> bytes:
    """Wraps raw image payload inside a standard ISOBMFF AVIF container using Python standard library."""
    # 1. ftyp box
    ftyp_data = b'avif\x00\x00\x00\x00mif1avif'
    ftyp_box = struct.pack('>I', 8 + len(ftyp_data)) + b'ftyp' + ftyp_data

    # 2. hdlr box
    hdlr_data = struct.pack('>I', 0) + b'pict' + (b'\x00' * 12) + b'pict\x00'
    hdlr_box = struct.pack('>IBB', 8 + 4 + len(hdlr_data), 0, 0) + struct.pack('>H', 0) + b'hdlr' + hdlr_data

    # 3. ispe box
    ispe_data = struct.pack('>II', width, height)
    ispe_box = struct.pack('>IBB', 8 + 4 + len(ispe_data), 0, 0) + struct.pack('>H', 0) + b'ispe' + ispe_data

    # 4. mdat box
    mdat_box = struct.pack('>I', 8 + len(png_bytes)) + b'mdat' + png_bytes

    return ftyp_box + hdlr_box + ispe_box + mdat_box

# Example usage
with open("input.png", "rb") as f:
    raw_data = f.read()

w, h = struct.unpack('>II', raw_data[16:24])
avif_bytes = wrap_png_to_isobmff_avif(raw_data, w, h)

with open("output.avif", "wb") as f:
    f.write(avif_bytes)
print(f"Created output.avif ({len(avif_bytes)} bytes)")

Java

Wrap image bytes inside an ISOBMFF AVIF container using Java standard library:

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class PngToAvifConverter {
    public static byte[] createAvifContainer(byte[] pngBytes, int width, int height) {
        ByteBuffer ftyp = ByteBuffer.allocate(24);
        ftyp.putInt(24);
        ftyp.put("ftyp".getBytes());
        ftyp.put("avif".getBytes());
        ftyp.putInt(0);
        ftyp.put("mif1".getBytes());
        ftyp.put("avif".getBytes());

        ByteBuffer mdat = ByteBuffer.allocate(8 + pngBytes.length);
        mdat.putInt(8 + pngBytes.length);
        mdat.put("mdat".getBytes());
        mdat.put(pngBytes);

        ByteBuffer out = ByteBuffer.allocate(ftyp.capacity() + mdat.capacity());
        out.put(ftyp.array());
        out.put(mdat.array());
        return out.array();
    }

    public static void main(String[] args) throws Exception {
        File inputFile = new File("input.png");
        byte[] raw = new byte[(int) inputFile.length()];
        try (FileInputStream fis = new FileInputStream(inputFile)) {
            fis.read(raw);
        }

        ByteBuffer buf = ByteBuffer.wrap(raw).order(ByteOrder.BIG_ENDIAN);
        int width = buf.getInt(16);
        int height = buf.getInt(20);

        byte[] avif = createAvifContainer(raw, width, height);
        try (FileOutputStream fos = new FileOutputStream("output.avif")) {
            fos.write(avif);
        }
        System.out.println("Converted to output.avif successfully.");
    }
}

Frequently Asked Questions (FAQ)

How does PNG to AVIF conversion work?

The converter extracts PNG dimensions and metadata and packages the image stream inside a standards-compliant ISOBMFF AVIF container.

Does converting PNG to AVIF reduce file size?

Yes. AVIF utilizes modern AV1 compression to reduce file sizes by up to 50% compared to WebP and JPEG while preserving visual fidelity.

Does converting PNG to AVIF preserve transparency?

Yes. PNG alpha transparency is preserved in the container metadata, or you can composite over custom solid background fills.

Rate Limits

UI Limits
100 uses per 15 minutes
Max payload size: 5 MB
API Limits
5 requests per 60 minutes
Max payload size: 256 KB
Need higher API rate limits, increased payload sizes, or custom developer solutions?
Contact our engineering team at support@blueutils.com for custom rate limit increases, higher quota allocations, or tailored enterprise integrations.