Image to Base64
Convert images to Base64 online: get a data URI, raw Base64, an <img> tag or CSS background for PNG, JPEG, SVG, WebP or GIF. Files stay in your browser.
Runs in your browser · Nothing uploadedFree · No sign-up
Something not working, or missing a feature? Send feedback
About the Image to Base64
The Image to Base64 converter turns a PNG, JPEG, SVG, WebP, GIF or AVIF file into Base64 text you can embed directly in HTML, CSS, JSON or Markdown. You get a ready-made data URI, the raw Base64, an <img> tag and a CSS background rule, and the image never leaves your browser.
Images are processed in your browser with its built-in codecs, so your photos and screenshots are never uploaded.
How to use the Image to Base64
- Drop an image onto the box, paste it from the clipboard, or choose a file.
- Pick the output you need: data URI, raw Base64, <img> tag, CSS background or Markdown.
- Copy the result into your code. The size line shows how much bigger the Base64 version is.
Where it works well
- Small icons and images to inline in HTML, CSS, JSON or email templates.
Where it struggles
- Large photos: Base64 is about a third bigger than the file and cannot be cached separately, so link to the file instead.
Common mistakes
- Inlining large images. A 200 KB photo becomes about 270 KB of text inside your HTML or CSS, delays rendering and is downloaded again with every page. Keep data URIs for small icons.
- Forgetting the prefix. Raw Base64 is not a URL. In src or url() you need the full data URI, including data:image/png;base64, at the start.
Works well with the Image to Base64
- Base64 to Image: decode a Base64 image again to check it.
- Base64 Encode / Decode: encode text rather than images.
- CSS Minifier: minify the CSS that contains the data URI.
Frequently asked questions
When should I inline an image as Base64?
For very small images, such as icons under a few kilobytes, in emails, single-file HTML documents or CSS that must not make extra requests. Larger images are better served as files, because Base64 is about 33% bigger and cannot be cached separately.
What is a data URI?
A URL that contains the file itself: data:image/png;base64, followed by the Base64 data. Browsers accept it anywhere an image URL is allowed, such as the src of an <img> or url() in CSS.
Is my image uploaded?
No. The file is read and encoded in your browser with the FileReader API; nothing is sent to a server.
Related tools
Base64 Encode / Decode
Decode Base64 to text or encode text to Base64 online, with full UTF-8 and URL-safe Base64 support. Conversion runs in your browser, so nothing is uploaded.
Runs in your browserBase64 to Image
Decode a Base64 string or data URI to an image online: preview it, see its type, size and dimensions, and download it as PNG, JPEG, SVG, WebP or GIF.
Runs in your browserBackground Remover
Remove the background from photos free with AI: full HD resolution, bulk images, transparent PNG or white background. No upload, no sign-up, no watermark.
Runs in your browserRemove Object from Photo
Remove unwanted objects, people and blemishes from photos free: paint over them and AI fills the background on your device. No upload, no sign-up, full size.
Runs in your browserRemove Text from Image
Remove text from images free: words, dates and captions are found automatically and AI rebuilds the background. Works on photos and screenshots, no upload.
Runs in your browserEdit Text in Image
Edit text in images online free: change words, prices and dates in photos and screenshots. Old text is removed with AI and new text matches size and colour.
Runs in your browser