Image tools
Image to Base64
Original image bytes. Ready to embed.
Processed on your device
Image file
Select a local image to encode without changing it.
No image selected
A preview will appear after encoding, if your browser supports the image.
Original bytes and metadata are preserved. This tool does not resize, compress, strip metadata or sanitize your image.
Encoded output
Your result will appear here.
Media type is identified from file headers, not the filename.
HTML output has an empty alt attribute. Add meaningful alternative text when placing it on your page.
Choose an image and output format, then encode.
How to use
Choose an image
Select a file from your device. Its original bytes, including metadata, stay intact.
Set the output format
Choose a data URI, raw Base64, an HTML image or a CSS background declaration.
Encode and copy
Encode the image, check the preview and copy or download the text result. Changing the format afterwards encodes again automatically.
Your image stays on your device.
Encoding runs locally without uploading or storing your file. Copy and download only happen when you choose them. Reset clears the input, preview and result.
Compatibility and size
Base64 is an encoding, not compression or encryption. Raw output uses four characters for each group of up to three original bytes; a data URI or snippet adds a small wrapper. There is no tool-imposed file size limit. The input and output must fit in your browser’s memory. Cancel stops encoding. To keep the page responsive, the text box shows only the first 1,000,000 characters of a longer output; Copy output and Download text always contain every character.
Common image headers identify PNG, JPEG, GIF, WebP, BMP, TIFF, AVIF, HEIC, SVG and ICO. Header recognition does not validate the entire image. Unrecognized headers use application/octet-stream and may need the correct media type before embedding. Your browser may not preview every format. Encoding does not repair damaged images or make unsupported formats compatible.
Frequently asked questions
Does it keep metadata and animation?
Yes. Encoding reads the original bytes without decoding and saving the image again. Metadata, color profiles and animation remain in the encoded file. Remove sensitive metadata before encoding if you intend to share the result.
Which output format should I choose?
Raw Base64 is useful when a destination expects only encoded bytes. A data URI includes the media type. HTML gives you an img element with an empty alt attribute; add appropriate alternative text. CSS gives you a background-image declaration to place inside a CSS rule.
Are SVG previews isolated?
SVG previews use an image element, where scripts and external resources are disabled by the browser. The encoded SVG itself is unchanged and is not sanitized. Do not treat encoding as making untrusted content safe for use as an active document.
Why is the media type different from my filename?
The tool inspects the file header rather than trusting an extension or browser-provided label. Unrecognized files, including SVG with an unrecognized prologue, get the generic application/octet-stream type. Raw Base64 still preserves their bytes.
Can I turn Base64 back into an image?
Use the Base64 encoder decoder, choose Decode and paste raw Base64 or a data URI. Download the decoded bytes with the original image extension.
Will the image work on every website?
The destination must support the image format and allow data images in its content security policy. Embedding a large image expands page or stylesheet text; linking a separate image file may be more practical.
Related tools: Base64 encoder decoder · Resize image · Browse all tools