Encode & Decode Base64 Images
Convert images to embeddable Data URIs and HTML snippets, or decode Base64 strings back into downloadable files.
Images as text, both directions, no server
Encode a picture into a Data URI with ready-made snippets, or decode a Base64 string back into a file.
Encode and decode both ways
Turn an image into a Data URI string, or paste a Base64 string back and preview and save the picture it represents.
Ready-to-paste snippets
The encoder hands back the raw Data URI plus copy-ready HTML img and CSS background-image snippets so the output drops straight into code.
Runs on your CPU
Encoding and decoding go through the browser's FileReader, so the operation is pure local computation with no network round-trip.
How to use Base64 Image Converter
Pick a mode
Encode an image or decode a Base64 string.
Add the input
Upload a file to encode, or paste a string to decode.
Copy or download
Grab the snippet, or save the decoded image.
FileReader on your CPU, nothing sent
Encoding and decoding happen through the browser's FileReader on your own machine. The image or string you provide is never uploaded to MediaDocks and is discarded as soon as you leave the page.
What it does
About the Base64 Image Converter
A Base64 image is a picture rewritten as plain text. Instead of a separate file on disk, the bytes of the image are encoded into an ASCII string — a Data URI — that can live directly inside an HTML document, a stylesheet, or a JSON payload. This tool does that translation in both directions: it encodes an image into a Data URI, and it decodes a Data URI back into a real image file you can save.
The reason to inline an image rather than link to it is to remove an HTTP request. Every external image a page references is a separate round-trip to a server, and for tiny assets — a 1-pixel spacer, a small icon, a logo in an email — the overhead of that request can cost more than the image itself. Embedding the bytes inline means the picture arrives with the document that uses it, which is exactly why email templates, single-file HTML exports and small CSS icons so often reach for Base64.
That convenience is not free, and the cost is size. Base64 represents three bytes of binary with four characters of text, so an encoded image is roughly a third larger than the original file. For a small icon that overhead is trivially outweighed by the saved request; for a large photograph it is a bad trade that bloats the document and cannot be cached separately. The practical line is simple — inline the small stuff, keep large images as linked files — and the tool makes the size visible so the choice is informed rather than blind.
The output is built to be pasted, not just read. Encoding returns the raw Data URI alongside an HTML img tag and a CSS background-image rule already wrapped around it, so the string drops into markup or a stylesheet without hand-editing. Decoding is the mirror image: paste a Base64 blob you received from an API or a config file, confirm it in the preview, and save it back out as a normal PNG or JPEG.
Step by step
Encoding or decoding, step by step
- 1
Choose encode or decode
Pick 'Image to Base64' to turn a file into a string, or 'Base64 to Image' when you already have a string and need the picture back out of it.
- 2
Provide the input
For encoding, drop in an image and it is read straight into a Data URI. For decoding, paste the Base64 text — with or without the leading data URI prefix — and the preview appears.
- 3
Copy the snippet or save the file
After encoding, copy the raw Data URI or one of the generated HTML and CSS snippets. After decoding, download the reconstructed image as a file.
Formats & limits
Inputs, outputs and the size trade-off
| Encode input | Any common raster image, e.g. PNG, JPG, GIF, WebP. |
|---|---|
| Encode output | Raw Data URI plus HTML <img> and CSS snippets. |
| Decode input | A Base64 string, with or without the data URI prefix. |
| Decode output | A downloadable image file. |
| Size note | Base64 text is about 33% larger than the binary original. |
In practice
Where inlining an image pays off
Embedding a small logo directly into an HTML email template so it renders without a hosted file.
Inlining a tiny icon as a CSS background-image to save an HTTP request on a critical page.
Decoding a Base64 image string returned by an API to inspect or save the actual picture.
Bundling an image into a single-file HTML document that has to work with no external assets.
Pure local computation
Both encoding and decoding are handled by the browser's FileReader and run entirely on your CPU. The image or string you provide is processed in local memory and never transmitted to MediaDocks, so nothing you paste or upload is logged or stored anywhere beyond the tab you are using.
FAQ
Base64 Image Converter questions
Formats, quality, limits and privacy, answered for this tool.
What exactly is a Base64 Data URI?
Why is the encoded string bigger than my image?
Can I paste a string that already has the data URI prefix?
When should I not inline an image as Base64?
Got a link? That is the entire setup.
No account required, no software installation, no hidden limits. Paste a public media link and pick the resolution you want.