Image to Base64 Converter
Your Base64 output will appear here.
Overview
Convert any image to Base64 in your browser
Upload any image and get a Base64 data URI instantly — eight ready-to-paste formats including HTML, CSS, Markdown, and JSON. All processing happens in your browser.
Step by step
How to convert an image to Base64
- 1 Upload your image
Drag and drop an image file onto the upload area, or click the area to browse your files. Supported formats: PNG, JPG, GIF, SVG, WebP, BMP, ICO, and AVIF (max 20 MB).
- 2 Preview and verify
Your image appears as a thumbnail so you can confirm it is the right file. The file name, format, and size are shown alongside the preview.
- 3 Choose your output format
The tool generates your Base64 string in eight ready-to-use formats. Click the tab for the format you need — Data URI, HTML <img>, CSS background-image, Markdown, JSON, JavaScript, or favicon <link>.
- 4 Copy to clipboard
Click the copy button next to your chosen format. A "Copied!" confirmation appears so you know the text is on your clipboard.
- 5 Paste into your project
Paste the Base64 string directly into your HTML, CSS, Markdown file, or JavaScript code. No external image file needed.
Output formats
Eight formats, one click each
| Format | Description | Example |
|---|---|---|
| Plain Base64 | Raw Base64 string with no prefix — useful when your code already constructs the data URI. | iVBORw0KGgo… |
| Data URI | A complete data URI ready to use anywhere a URL is accepted: <img src>, CSS url(), JavaScript. | data:image/png;base64,iVBORw0KGgo… |
| HTML <img> | A ready-to-paste <img> tag with the data URI as the src and the filename (without extension) as alt. | <img src="data:image/png;base64,…" alt="photo"> |
| CSS background | A background-image CSS property value, ready to paste into any CSS rule. | background-image: url("data:image/png;base64,…"); |
| Markdown image | A Markdown image shortcode using the data URI — works in GitHub README files, Notion, and most editors. |  |
| JSON object | A JSON object with mime and base64 keys — useful for APIs, configuration files, or storage. | { "mime": "image/png", "base64": "…" } |
| JS new Image() | A JavaScript snippet that creates an Image element with the encoded source. | const img = new Image(); img.src = "data:…"; |
| Favicon <link> | An HTML <link> tag for embedding a Base64 favicon directly in the <head> of a page. | <link rel="icon" type="image/png" href="data:…"> |