Image to Base64 — Data URI, <img> Tag, CSS and Markdown
Convert PNG/JPG/WebP assets into copyable Data URI, <img> & CSS url() code.
When to use the Image File to Base64 Data URI & CSS Converter
Small icons without extra requests
Icons, small logos or placeholder images can be embedded straight into HTML or CSS as a data URI, so the page does not need a separate request for the file.
Email templates and single-file HTML
An HTML report sent as one file or offline documentation still shows its images, because they travel inside the file. Choose the <img> format, which already includes width, height and alt.
Original bytes, the right MIME type
The file is not re-encoded: the Base64 comes from its original bytes, and the MIME type comes from the content (magic bytes), not the file name. A JPG named .png is still written as image/jpeg.
Shorter SVG without Base64
For SVG there is a URL-encoded data URI, usually shorter than Base64 and still readable, which suits icons in CSS.
Frequently asked questions
What is the difference between a data URI and plain Base64?
Plain Base64 is just the encoded text. A data URI adds a prefix such as data:image/png;base64, so the browser knows what the data is and can use it directly in src or url().
Is my image uploaded?
No. The file is read and encoded in your browser; nothing is sent to a server.
How do I use the result in CSS?
Choose the CSS tab to get a background-image: url("…"); line ready to paste into a rule. For SVG icons, URL encoding usually gives smaller CSS.
How do I turn Base64 back into an image?
Use Base64 to Image: paste the text, check the preview, then download the original file or save it as PNG, JPG or WebP.
Similar tools
- Base64 Data URI to Downloadable Image ConverterPaste a Base64 Data URI string to preview and download as PNG/JPG/WebP.
- AVIF to JPG Image Converter (100% Client-Side)Decode modern AVIF photos in your browser and export standard JPEG downloads.
- Image to PDF Converter (JPG/PNG/WebP to Multi-Page A4 & F4 PDF)Turn one or many JPG, PNG or WebP pictures into an A4, F4/Folio or Letter multi-page PDF locally in your browser without uploading.
- JPG to Lossless PNG Image ConverterConvert JPEG photos cleanly into lossless PNG files directly in browser.