Image to Base64 Converter ๐ Nothing uploaded
Drag in, drop or paste an image to get a Base64 string for HTML, CSS, Markdown or JSON. Shrink it first so the code stays small. Or paste Base64 to turn it back into a picture.
PNG, JPG, WebP, GIF, SVG ยท several at once
Shrink before encoding (recommended for the web)
How to use the Image to Base64 Converter
- Add your imageDrag it onto the box, click to choose it, or copy an image and paste it with Ctrl+V.
- Optionally shrink itOpen Shrink before encoding, choose WebP, set a max width and quality. The size warning tells you if the result is still large.
- Pick an output formatChoose Data URI, Raw Base64, an
tag, CSS, Markdown or a JSON string.
- Copy or downloadClick Copy to paste into your code, or Download .txt to save it.
- Need it the other way?Switch to Base64 โ Image, paste your text and download the decoded picture.
How creators use it
Inline a logo in an email
HTML email signatures and newsletters can show a logo without hosting a separate file.
Build single-file pages
Put icons and small graphics inside one HTML file for overlays, widgets and stream alerts.
Test APIs and apps
Create image test data quickly for JSON requests, mock responses and prototypes.
Send images in text-only places
Share a small image where only text is accepted, such as some CMS fields or config files.
Pro tips
- Keep inline images under about 10 KB. Anything bigger slows the page and cannot be cached.
- Use WebP and a smaller width first: it often cuts the size by more than half.
- SVG images are already text, so they often work better as plain inline SVG.
- Paste straight from your clipboard with Ctrl+V to skip saving a file.
Common mistakes
- Inlining large photos, which makes every page load slow.
- Forgetting the data:image/png;base64, prefix when using a raw string in HTML or CSS.
- Pasting Base64 with missing or cut-off characters, which breaks the picture.
- Using Base64 for images you use on many pages. A normal file is cached and loads only once.
Learn more in the PexBell guide: Every Image Format Explained: JPEG, PNG, WebP, AVIF, HEIC, SVG and More
FAQ
What is Base64?
A way of writing binary data, such as an image, as plain text using only letters, numbers and a few symbols. It lets you put a picture directly inside HTML, CSS or JSON without a separate file.
Why is the Base64 text bigger than my image?
Base64 stores every 3 bytes as 4 characters, so the text is about 33% larger than the original file.
When should I use a Base64 image?
For tiny images such as icons, logos and placeholders (under about 10 KB), or when you can only paste text, for example in an HTML email signature or a single-file page. For large photos use a normal image file.
How do I put a Base64 image in HTML?
Use the tag button to copy ready-made code, for example
. For CSS use the CSS background button.
How can I make the Base64 smaller?
Open Shrink before encoding, convert to WebP, set a max width and lower the quality. A 500 KB photo can often drop below 50 KB.
Is my image uploaded anywhere?
No. Everything happens inside your browser. The image never leaves your device.
How do I turn Base64 back into an image?
Switch to Base64 โ Image, paste the text (with or without the data:image prefix) and download the picture.
Made by PexBell for creators. Free, no signup, runs in your browser. Last updated November 2026.
More free tools
Unit Converter
Length, weight, temperature, data size, bitrate and more.
QR Code Generator
Links, Wi-Fi, contacts and more, with logo, colours and SVG download.
Secure Password Generator
Strong passwords, passphrases and PINs with an entropy meter.
JSON Formatter & Validator
Beautify, validate, minify and repair JSON, with a tree view.
Giveaway Winner Picker
Fair random winners with filters, backups and a fairness proof.
Countdown Timer to a Date
Live countdown to any date, with share links and an OBS stream mode.