Image to Base64 & Base64 to image
A free image encoder and decoder. Convert files, preview the result and download the original bytes. Entirely on your device.
ToolImage ↔ Base64Change
PNG, JPEG, GIF and WebP. File / decoded limit: 5 MiB. Encoded text limit: 7 MiB. Preview: up to 20 megapixels and 16,384 px per side.
Nothing selected. Your file stays in this browser.
Ready. All conversion runs locally.
Local preview
Your image preview will appear here.
Preview shows the first 65,536 characters. Copy and save include the full output.
How to convert image to Base64
- Select Image → Base64 and choose or drag in one supported file, up to 5 MiB.
- Choose Pure Base64 for an API field or Data URL when a MIME prefix is required.
- Copy the complete result or save it as a text file. Your original image quality is preserved.
How to convert Base64 to image
- Select Base64 → image and paste a Base64 string or a complete Data URL.
- Click Decode image. The tool checks encoding, size and supported file headers locally.
- Inspect the image preview and dimensions, then select Save image file to download the original bytes with the correct extension.
PNG and JPEG for JSON APIs and Data URLs
Use this tool to prepare a PNG, JPEG, GIF or WebP for a JSON image field, inspect an inline Data URL, or restore an encoded image returned by an API. A Data URL prefix is not part of the Base64 payload: use only the format required by the receiving API.
For large files or repeated requests, consider direct binary uploads or a file reference when your API supports them. Base64 adds approximately 33% to the byte count for larger files; it is not compression or encryption.
Related tools: Audio to Base64 converter · Base64URL encoder and decoder · Base64 use cases and alternatives · Linux Base64 commands
Image Base64, explained
Is my image uploaded?
No. Files are read into browser memory and converted in a local worker. This page does not load Google Analytics, call an AI service, or save your media in browser storage. Preview uses a local Blob URL. Clear all releases the result and stops playback. Downloads and clipboard copies are stored on your device at your request. Website hosting still receives ordinary page requests.
Does this change the file format or quality?
No. Base64 preserves the original bytes; it does not compress, transcode, enhance or encrypt your file. JPEG remains JPEG, and PNG remains PNG. Encoded data is usually about one third larger.
Pure Base64 or Data URL?
Pure Base64 contains only the encoded bytes. A Data URL adds a prefix such as data:image/png;base64,. Use the format your API expects. The decoder accepts both, checks the declared MIME type against supported file headers, and rejects mismatches. Header recognition is not full file validation or a security scan.
Why is my file rejected or not previewing?
Files must be within the limits and match a supported header. SVG, HTML, HEIC and AVIF are not supported in this version. Large image dimensions are rejected before preview. A damaged file or unsupported browser codec may not preview even when its header is recognized. Playback never starts automatically. Only open files you trust.