Image and Base64
Convert an image to Base64 and back
No database: AIMRAN doesn't store your files, text or results
What is Image and Base64?
Base64 is a way of writing an image as text. Developers use it to embed small icons directly in HTML, CSS, JSON or emails without needing a separate file.
This tool works both ways: you turn an image into its Base64 code to copy it, or paste some Base64 you have been given and see it as an image to download.
How to use it
- Choose “Image to Base64” or “Base64 to image” mode.
- To encode, drag in the image and choose “Data URL” or “Base64 only”.
- Copy the result or download it as a .txt file.
- To decode, paste the Base64 text or Data URL and download the resulting image.
Advantages
- Works in both directions on the same page.
- Output as a Data URL ready for HTML and CSS, or as plain Base64.
- Detects the image's real format when decoding.
- Accepts Base64 with line breaks and the URL-safe variant.
Use cases
- Embed a small icon in a CSS or HTML file as a Data URL to save a request.
- Put a logo inside an email signature or an HTML email template.
- See which image is hiding in a Base64 string found in a JSON file, a log or an API response.
- Prepare images as text to send them in the body of an API request.
Technical details
Encoding produces a Data URL (data:<type>;base64,...) or just the Base64 string, and accepts any image, SVG and ICO included, up to 10 MB; above 100 KB linking the file is recommended, since Base64 increases the size by around 33%. Decoding accepts text with or without the data: prefix, ignores spaces and line breaks, supports the URL-safe alphabet (- and _) and adds any missing = padding. The image type is identified by its binary signature: PNG, JPEG, GIF, WEBP, AVIF, BMP, ICO and SVG; if it is not recognized, the type declared in the Data URL is used.
Frequently asked questions
How do I convert an image to Base64?
Choose “Image to Base64”, drag in the image and copy the result. Use “Data URL” if you are going to paste it into an HTML src or CSS.
How do I view a Base64 image?
Choose “Base64 to image” and paste the text. The image will be shown and you can download it with the right extension.
What is a Data URL?
It is Base64 with a prefix that states the type, for example data:image/png;base64,... It can be used directly as an image address.
When should I use Base64 images?
For small icons and graphics. For large images it is better to link the file, because Base64 takes up roughly a third more space.
Blog guides
Related tools
- Base64, URL and HTML · Encode and decode in all three formats
- Convert image · Convert between JPG, PNG, WEBP, AVIF, HEIC, TIFF, PSD, ICO, PDF and more
- Compress image · Reduce file size with quality control and a before/after comparison
- Minifier · CSS, JS and HTML
- Favicon generator · All the usual sizes, ready in a ZIP
- Resize · Change the size in pixels or percent, also in batches