PNG to ICO Converter

Convert Portable Network Graphics (PNG) images into multi-resolution Windows Icon (ICO) files and browser favicons with customizable dimensions, transparency preservation, and instant downloads.

Choose a PNG image or drag & drop here Supports .png icons and logos with 32-bit alpha transparency (Max 5MB)
Browser Processing & Maximum File Limits

All PNG parsing and ICO container assembly are performed client-side and via the API. Maximum file size is 5MB per upload.

How to Convert PNG to ICO 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

Select Favicon Icon Dimensions

Choose standard multi-resolution icon sizes (16×16, 32×32, 48×48, 64×64, 128×128, or 256×256 px).

3

Convert & Download

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

Tool Options

Multi-Size Favicon Generation

Package icons into standard 16×16, 32×32, 48×48, 64×64, or 256×256 px ICO containers for browsers and apps.

Alpha Transparency Preservation

Retains smooth transparent backgrounds and crisp anti-aliased outlines across dark and light browser tabs.

HTML Embed Snippets

Provides ready-to-use HTML favicon link tags and Base64 icon strings for fast website deployment.

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 ICO Converter do?

The PNG to ICO Converter converts Portable Network Graphics (.png) raster images into Windows Icon (.ico) resource containers and web favicons. Windows ICO files encapsulate one or more bitmap or PNG image streams paired with directory headers that specify pixel dimensions, color bit depth, and byte offset locations.

This utility validates PNG binary headers, reads intrinsic dimensions and alpha channel transparency from the IHDR chunk, and packages the data into standards-compliant ICONDIR and ICONDIRENTRY structures. It supports standard favicon resolutions (16x16, 32x32, 48x48, 64x64, 128x128, 256x256), custom dimensions, solid background fill compositing, and instant browser downloads.

Core Concepts

Working with Windows Icon (ICO) formats involves several binary data structures:

  • ICONDIR Structure: The 6-byte file header starting with two reserved bytes (0x0000), a 2-byte resource type (1 for ICO, 2 for CUR cursor), and a 2-byte count field specifying the number of image frames.
  • ICONDIRENTRY Array: A 16-byte entry descriptor per image frame. It defines width and height in pixels (where 0 denotes 256 pixels), palette color count, color planes, bits per pixel (e.g. 32-bit for RGBA), total payload byte size, and the absolute file offset where the image resource starts.
  • PNG Embedding in ICO: Since Windows Vista, the ICO specification natively allows direct embedding of raw PNG compressed bitstreams inside the icon resource block rather than raw uncompressed BMP DIB bitmaps. This preserves 8-bit alpha channel transparency and reduces favicon file sizes.
  • Favicon Resolution Standards: Modern browsers request 32x32 or 16x16 icons for browser tabs and bookmarks, while desktop shortcuts, taskbars, and high-DPI displays use 48x48, 64x64, 128x128, and 256x256 resolutions.

How to use the tool?

  1. Upload or Paste PNG: Drag and drop a .png file into the upload zone, click Browse File, or paste a Base64-encoded PNG Data URI into the text box. Click Load Sample to test with an example image.
  2. Select Icon Size: Choose from standard icon resolution presets: 16 × 16 px (Browser Tab Favicon), 32 × 32 px (Standard Favicon), 48 × 48 px (Windows Medium Icon), 64 × 64 px (High-DPI Display), 128 × 128 px (App Launcher / Dock), 256 × 256 px (Full Windows 11 / Vista HD), or select Custom Dimensions.
  3. Configure Background: Select Transparent Alpha to preserve transparency, or choose Solid White, Dark Navy, or Custom Color with the hex code input.
  4. Convert & Download: Click Convert to ICO. The tool generates a live preview, shows the resulting byte size, and provides a direct Download button for favicon.ico alongside ready-to-use HTML <link rel="icon"> tags and Base64 Data URIs.

Related Developer Utilities

Complementary icon and 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-ico) for programmatic favicon and Windows icon 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.size Number Optional. Square icon dimension preset (e.g. 16, 32, 48, 64, 128, 256). Defaults to 32. 32
options.width Number Optional. Explicit target width in pixels (16 to 256). 64
options.height Number Optional. Explicit target height in pixels (16 to 256). 64
options.scale Number Optional. Resolution scaling multiplier. 1
options.bgColor String Optional. Background color fill ("transparent", hex string like "#FFFFFF"). Defaults to "transparent". "transparent"

API Request Payload Examples

cURL

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

Python

import requests

url = "https://blueutils.com/api/image/png-to-ico"
payload = {
    "rawText": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNk+M9Qz0AEYBxVSF+FAAhKDveksOjuAAAAAElFTkSuQmCC",
    "options": {
        "size": 32,
        "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\": {\"size\": 32, \"bgColor\": \"transparent\"}}";
        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://blueutils.com/api/image/png-to-ico"))
            .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/x-icon"). "image/x-icon"
originalFormat String MIME type of source image ("image/png"). "image/png"
dataUri String Complete ICO Base64 Data URI. "data:image/x-icon;base64,AAAB..."
base64 String Pure Base64-encoded ICO binary buffer string. "AAABAAEA..."
metadata Object Dimensions, aspect ratio, frame count, byte sizes, and format details. { "originalWidth": 10, "targetWidth": 32, ... }
snippets Object HTML <link rel="icon"> and Markdown embed snippets. { "html": "<link rel=\"icon\"...>" }

API Response Payload Examples

Success Response (HTTP 200 OK)

{
  "isValid": true,
  "mimeType": "image/x-icon",
  "originalFormat": "image/png",
  "dataUri": "data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAGAAAAAAAQ...",
  "base64": "AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAGAAAAAAAQ...",
  "metadata": {
    "originalWidth": 10,
    "originalHeight": 10,
    "targetWidth": 32,
    "targetHeight": 32,
    "size": "32x32",
    "bgColor": "transparent",
    "bitDepth": 32,
    "colorType": "RGBA Truecolor with Alpha",
    "hasAlpha": true,
    "frameCount": 1,
    "formatType": "Windows Icon Resource (.ico)",
    "aspectRatio": 1,
    "originalSizeBytes": 70,
    "icoSizeBytes": 92,
    "formattedSize": "92 B"
  },
  "snippets": {
    "html": "<link rel=\"icon\" type=\"image/x-icon\" href=\"data:image/x-icon;base64,...\">",
    "htmlShortcut": "<link rel=\"shortcut icon\" href=\"/favicon.ico\" type=\"image/x-icon\">",
    "markdown": "![Favicon Icon](data:image/png;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 ICO?

Integrating the PNG to ICO API into build systems, static site generators, and CI/CD pipelines provides several benefits:

  • Rapid Script Validation: Enables automated build tools and deployment scripts to generate cross-browser compatible favicon.ico files on the fly without heavy native image dependencies.
  • Optimized Token Efficiency for AI Agents: LLMs struggle with constructing binary structures like ICONDIR headers and byte offset arithmetic. Offloading ICO generation to a deterministic API saves valuable prompt and completion tokens.
  • Deterministic Accuracy Without Hallucinations: Image format byte structures require strict byte alignment and valid PNG data offsets. The API guarantees 100% compliant binary packaging.

Native Usage

How to convert PNG images to ICO format locally using native operating system tools and standard libraries:

Windows (PowerShell)

On Windows, PowerShell can use .NET and System.Drawing to create icons:

Add-Type -AssemblyName System.Drawing

$sourcePng = "favicon.png"
$targetIco = "favicon.ico"

$bitmap = [System.Drawing.Bitmap]::FromFile((Resolve-Path $sourcePng))
$hIcon = $bitmap.GetHicon()
$icon = [System.Drawing.Icon]::FromHandle($hIcon)

$fileStream = New-Object System.IO.FileStream($targetIco, [System.IO.FileMode]::Create)
$icon.Save($fileStream)
$fileStream.Close()

$icon.Dispose()
$bitmap.Dispose()
Write-Host "Created $targetIco successfully."

Linux / Unix (Bash)

On Linux/macOS, use ImageMagick or standard CLI tools:

# Using ImageMagick CLI (multi-resolution standard favicon)
magick input.png -define icon:auto-resize=64,48,32,16 favicon.ico

# Or single-resolution conversion
magick input.png -resize 32x32 favicon.ico

Python

Create a standard Windows ICO file from PNG bytes using the Python standard library:

import struct

def png_to_ico(png_path: str, ico_path: str, width: int = 32, height: int = 32):
    """Wraps a PNG file into a valid Windows ICO container using Python standard library."""
    with open(png_path, "rb") as f:
        png_bytes = f.read()

    # 1. ICONDIR Header: [Reserved (2B), Type=1 (2B), Count=1 (2B)]
    icondir = struct.pack("<HHH", 0, 1, 1)

    # 2. ICONDIRENTRY: [Width (1B), Height (1B), Colors (1B), Reserved (1B), Planes (2B), BitCount (2B), BytesInRes (4B), ImageOffset (4B)]
    w_byte = 0 if width >= 256 else width
    h_byte = 0 if height >= 256 else height
    data_offset = 6 + 16 # Header (6B) + 1 Entry (16B) = 22B
    icondirentry = struct.pack("<BBBBHHII", w_byte, h_byte, 0, 0, 1, 32, len(png_bytes), data_offset)

    with open(ico_path, "wb") as f:
        f.write(icondir)
        f.write(icondirentry)
        f.write(png_bytes)

    print(f"Created {ico_path} ({len(icondir) + len(icondirentry) + len(png_bytes)} bytes)")

# Example execution
png_to_ico("input.png", "favicon.ico", 32, 32)

Java

Create an ICO container wrapping PNG bytes 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 PngToIcoConverter {
    public static byte[] createIcoContainer(byte[] pngBytes, int width, int height) {
        int dataOffset = 22; // 6 (ICONDIR) + 16 (ICONDIRENTRY)
        ByteBuffer buf = ByteBuffer.allocate(dataOffset + pngBytes.length);
        buf.order(ByteOrder.LITTLE_ENDIAN);

        // ICONDIR
        buf.putShort((short) 0); // idReserved
        buf.putShort((short) 1); // idType = 1 (ICO)
        buf.putShort((short) 1); // idCount = 1

        // ICONDIRENTRY
        byte bW = (byte) (width >= 256 ? 0 : width);
        byte bH = (byte) (height >= 256 ? 0 : height);
        buf.put(bW);
        buf.put(bH);
        buf.put((byte) 0);       // bColorCount
        buf.put((byte) 0);       // bReserved
        buf.putShort((short) 1); // wPlanes
        buf.putShort((short) 32);// wBitCount
        buf.putInt(pngBytes.length); // dwBytesInRes
        buf.putInt(dataOffset);      // dwImageOffset

        // Image data
        buf.put(pngBytes);
        return buf.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);
        }

        byte[] ico = createIcoContainer(raw, 32, 32);
        try (FileOutputStream fos = new FileOutputStream("favicon.ico")) {
            fos.write(ico);
        }
        System.out.println("Converted to favicon.ico successfully.");
    }
}

Frequently Asked Questions (FAQ)

How does PNG to ICO conversion work?

The converter reads PNG IHDR metadata and builds an ICONDIR header and ICONDIRENTRY directory wrapping the PNG bitstream into a standard Windows ICO container.

What favicon sizes are supported?

You can generate 16x16, 32x32, 48x48, 64x64, 128x128, and 256x256 px icons or specify custom dimensions.

Does converting PNG to ICO support transparency?

Yes. Converting 32-bit PNGs to ICO preserves full RGBA 8-bit alpha channel transparency.

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.