Skip to content
Kordu Tools
Image Tools Runs in browser Updated 31 Mar 2026

Image to Base64 Encoder

Convert any image to Base64 — get data URL, raw Base64, CSS background-image rule, or HTML img snippet.

Output Format

Click to upload or drag and drop

PNG, JPG, JPEG, WEBP, GIF, SVG, BMP up to 5MB

Loading rating…

How to use Image to Base64 Encoder

  1. Upload your image

    Click the upload area or drag and drop any image file (PNG, JPG, WebP, GIF, SVG, BMP). Best results with files under 5KB — use image compressor for larger files first.

  2. Choose output format

    Select from four formats: Data URL (src-ready string), Base64 (raw string), CSS (background-image rule), or HTML (complete img tag).

  3. Copy the result

    Click the output field or the Copy button to copy the encoded string to your clipboard. Paste directly into your CSS, HTML, or JSON.

Image to Base64 Encoder FAQ

When should I use Base64 image encoding?

Base64 is best for small images (under 5KB) — favicons, tiny icons, small logos, and inline SVGs — where embedding avoids an extra HTTP request. For larger images, a regular file reference loads faster because Base64 adds ~33% overhead.

Is my file uploaded to a server?

No. The encoding happens entirely in your browser using the FileReader API. Your images never leave your device.

What's the difference between a data URL and raw Base64?

A data URL includes the MIME type prefix (e.g. data:image/png;base64,...) and is ready to use directly in HTML src attributes or CSS url() values. Raw Base64 is just the encoded string without the prefix — useful for APIs and JSON payloads.

Does Base64 increase the file size?

Yes. Base64 encoding increases data size by approximately 33%. A 1KB image becomes ~1.3KB encoded. This overhead is acceptable for tiny images but makes Base64 inefficient for large photos.

Can I decode a Base64 string back to an image?

Use the Base64 Encoder/Decoder tool in the developer tools section to decode a Base64 string back to binary data.

What image formats are supported?

PNG, JPG/JPEG, WebP, GIF, SVG, and BMP. The correct MIME type is automatically included in the data URL output.

Can I use the CSS output directly?

Yes. The CSS output format generates a complete background-image property value: background-image: url('data:image/png;base64,...'); — ready to paste into your CSS rule.

Is there a file size limit?

Files up to 5MB are accepted. However, for practical use, Base64 is only beneficial for very small images (under 5KB). Larger files should be served as regular image files.

Background

Base64 encoding converts binary image data into a text string that can be embedded directly in HTML, CSS, JSON, or any text-based format — eliminating the need for a separate image file and its associated HTTP request. This is useful for small images like icons, inline SVGs, data URIs for email templates, and tiny logos where the round-trip request cost outweighs the size overhead.

Four output formats cover every use case: data URL (ready to paste into an HTML src attribute or CSS url() function), raw Base64 string (for JSON payloads or custom processing), CSS background-image rule (paste directly into your stylesheet), and HTML img tag with the complete inline encoding ready to paste into your markup.

File size is shown before and after encoding so you can see the ~33% overhead Base64 adds. Click any value to copy it to clipboard with a single click.

Important: Base64 increases data size by ~33% and is only beneficial for files under ~5KB. For larger images, a normal external file reference is always faster. This tool is best for favicons, small icons, SVG sprites, and data URIs in CSS.

All processing uses the browser's FileReader API. Your images never leave your device.