Image to Base64
Drop an image and get a data URL you can paste into HTML or CSS, or the raw Base64 body. The file never leaves this tab.
Image
Limits
- Each file can be up to 20 MB. Larger files, or several at once, can exhaust memory on a phone.
- This page does not resize or recompress the image. Use Image Compressor or Image Resizer first if you need a smaller string.
- Preview depends on what this browser can render (for example AVIF or HEIC may preview blank in some browsers even though the Base64 is correct).
- A data URL is often larger than the original file (about 4/3 the size) and is a poor way to ship large photos on a website.
Base64
How to use Image to Base64
- Add an imageDrop a JPG, PNG, GIF, WebP, SVG, BMP, ICO or AVIF file, or paste from the clipboard if your browser allows it.
- Choose the outputA full data: URL (with the MIME type) or raw Base64 without the prefix.
- Copy or downloadCopy the text or download it as a .txt file. A preview is shown when the browser can render the type.
What is in the string
The file bytes are read with FileReader and encoded as standard Base64. A data URL starts with data:<mime>;base64, so an <img src> or a CSS url() can use it directly. Raw mode is only the Base64 body, which some APIs expect.
The image is not recompressed or resized unless your browser already decoded it for the preview. SVG is treated as text/xml or image/svg+xml from the file type. Nothing is uploaded.
Frequently asked questions
Is my text or file uploaded?
No. Everything runs in your browser tab with JavaScript. Nothing you type, paste or drop is sent to a server, logged or stored by ALink Tools.
Why is the text longer than the file?
Base64 uses 4 characters for every 3 bytes, plus a short prefix, so the string is about 33% larger than the file.
Should I embed a photo in CSS this way?
Small icons, maybe. A large photo will bloat the stylesheet and skip normal image caching. Prefer a regular image URL for photos.
Is HEIC supported?
The bytes can still be Base64-encoded. Preview and some browsers’ MIME sniffing may fail until you convert the file (for example with HEIC to JPG).
Related tools
All toolsBase64 to Image
Decode a Base64 data URL or raw Base64 string into an image file in your browser.
Base64 Encoder & Decoder
Encode or decode UTF-8 text, URL-safe Base64, and local files.
Image Converter
Convert JPG, PNG, WebP, HEIC, TIFF, SVG, GIF, BMP and AVIF in one place.
Favicon & ICO Generator
Make favicon.ico, Apple touch and PWA icons from an image or text.