Convert Image to Base64
Encode an image as Base64 text you can paste into HTML, CSS, JSON or Markdown. The file is read in your browser and never sent anywhere.
- Free, no daily limits
- Files never uploaded
- Five output styles
- No sign-up
- Runs on your device. Files are never uploaded.
- Free and unlimited. No sign-up, no watermark.
Image to base64 in three steps
No account, no email, no waiting for an upload.
- STEP 01
Add your image
Drop one or more picture files on the page, or tap Choose file.
- STEP 02
Pick the output style
Choose a data URL, plain Base64, an HTML img tag, a CSS background or a Markdown image.
- STEP 03
Copy or download the text
Each image becomes a text file ready to paste into your code.
What Image to base64 does, and what it doesn't
We'd rather tell you up front than surprise you after the download.
What you get
- Five ready-to-paste formatsData URL, plain Base64, HTML img tag, CSS background-image and Markdown.
- Correct type detectedThe image type is read from the file's own bytes, so the data URL carries the right content type.
- File is not changedThe image is encoded as it is, with no re-compression or loss.
- Character count shownSee how long the result is before you paste it.
- PrivateEncoding happens in your browser. Your image is not uploaded.
Good to know
- Base64 is biggerEncoded text is roughly a third larger than the original file, so it suits small images. Shrink big ones first with Compress image.
- Not for large picturesEmbedding large images in a page slows it down and cannot be cached separately.
- Output is textYou get a .txt file with the code. It does not preview the image.
- Reverse itTo turn Base64 back into a picture, use Base64 to image.
Your photos never leave your device
The tool runs inside your browser instead of on our servers, so there is nothing to upload, store or delete afterwards.
Typical online tool upload
Your file travels over the internet, sits on someone else's computer for a while, and you wait for the upload and the download.
Mediaextractr no upload
The tool loads into your browser once, then works on your file locally. Nothing is sent, so nothing can leak.
When people use Image to base64
Embed small icons in CSS
Skip an extra request for tiny images.
Inline images in HTML email
Keep a logo inside the markup itself.
Store an image in JSON
Send a picture through an API that only takes text.
Make a single-file page
Bundle images into one HTML or Markdown document.
Mediaextractr vs typical upload tools
| MediaextractrPrivate | Typical upload tools | |
|---|---|---|
| Your file is uploaded | Never | Yes |
| Sign-up needed | No | Often, after a few files |
| Daily file limit | None | Often 1–2 free files |
| Watermark | Never | Sometimes |
| Wait for upload & download | No | Yes |
| Speed on very large files | Depends on your device | Depends on their servers |
What Base64 does
Base64 represents binary data using only letters, numbers and a few symbols. That makes it safe to put inside text formats such as HTML, CSS, JSON and Markdown.
A data URL adds a small header, data:image/png;base64, in front, so a browser knows how to read the text as an image.
Choosing an output
Pick the one that matches where you will paste:
- Data URL: for an img src or CSS url().
- Plain Base64: for APIs and JSON fields.
- HTML img tag: a full tag with alt text from the file name.
- CSS background-image: a ready declaration.
- Markdown: a standard image link.
Keep it light
Resize with Resize image and compress with Compress image before encoding. Smaller input means shorter text and a faster page.
Questions, answered
How do I convert an image to Base64?
Add the image, choose an output style and copy or download the text.
What is a data URL?
It is a Base64 string with a short header that lets browsers show it as an image without a separate file.
Is my image uploaded?
No. The encoding is done in your browser.
Why is the Base64 text longer than the file?
Base64 uses four characters for every three bytes, so it is about a third bigger.
Does it work on phone and desktop?
Yes, in any modern browser.
Which images can I use?
Common formats such as JPG, PNG, WebP, GIF, SVG and others. The file is encoded as it is.