Image to Base64
Encode one JPG, PNG or WebP image as Base64 text or a data URL.
- 1Add input
- 2Adjust settings
- 3Get your result
Tool input and files are processed in this browser without being uploaded.
Before you start
Encode the original bytes of one validated static JPEG, PNG or WebP image as plain Base64 or a data URL using its detected MIME type. The image is not resized or re-encoded; Base64 text is typically about one-third larger than the binary file.
How to use this tool
- Choose one saved JPEG, PNG or WebP image. The original stays on your device.
- Keep Data URL selected when you need a complete image URL, or choose Base64 only for the encoded bytes without a prefix. Select “Generate Base64”.
- The page shows at most the first 4000 characters. Use “Copy result” for the complete text, or download the full .txt file if copying fails. Check the receiving page or API’s required form and size limit.
Supported inputs and limits
One static JPEG, PNG or WebP image up to 20 MiB and 16 million pixels. Animated images and SVG are not supported. Large encoded text can be cumbersome to paste or embed.
Encoding starts only after the browser validates and decodes the saved image. An unreadable file, unsupported decoder or unexpected decoded dimensions can stop the run, even though the original bytes are not changed. Export a fresh static image or try a browser with compatible image support.
The input filename, including its extension, is limited to 512 UTF-16 code units; some emoji use two. The 4000-character preview is only the start of a long result. Copying depends on browser clipboard access, while the .txt download keeps the complete text.
Worked example
Example input
pixels.png
Example options
{}Example output
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAADICAYAAADGFbfiAAAC60lEQVR4nO3XsQ2AMBAEQRvRf8umAUg2sZFmKrjktfq5xlgDeDWdB3y6dg8A4J8EBIBEQABIBASAREAASAQEgERAAEgEBIBEQABIBASAREAASAQEgERAAEgEBIBEQABIBASAREAASAQEgERAAEgEBIBEQABIBASAREAASAQEgERAAEgEBIBEQABIBASAREAASAQEgERAAEgEBIBEQABIBASAREAASAQEgERAAEgEBIBEQABIBASAREAASAQEgERAAEgEBIBEQABIBASAREAASAQEgERAAEgEBIBEQABIBASAREAASAQEgERAAEgEBIBEQABIBASAREAASAQEgERAAEgEBIBEQABIBASAREAASAQEgERAAEgEBIBEQABIBASAREAASAQEgERAAEgEBIBEQABIBASAREAASAQEgERAAEgEBIBEQABIBASAREAASAQEgERAAEgEBIBEQABIBASAREAASAQEgERAAEgEBIBEQABIBASAREAASAQEgERAAEgEBIBEQABI7t0D4Gxz7l4Ap/KBAJAICACJgACQCAgAiYAAkAgIAImAAJAICACJgACQCAgAiYAAkAgIAImAAJAICACJgACQCAgAiYAAkAgIAImAAJAICACJgACQCAgAiYAAkAgIAImAAJAICACJgACQCAgAiYAAkAgIAImAAJAICACJgACQCAgAiYAAkAgIAImAAJAICACJgACQCAgAiYAAkAgIAImAAJAICACJgACQCAgAiYAAkAgIAImAAJAICACJgACQCAgAiYAAkAgIAImAAJAICACJgACQCAgAiYAAkAgIAImAAJAICACJgACQCAgAiYAAkAgIAImAAJAICACJgACQCAgAiYAAkAgIAImAAJAICACJgACQCAgAiYAAkAgIAImAAJAICACJgACQCAgAiYAAkAgIAImAAJAICACJgACQCAgAiYAAkAgIAImAAJAICACJgACQCAgAiYAAkAgIAImAAJAICACJgACQPE4MBJJrZADfAAAAAElFTkSuQmCC
When something does not work
Use a complete static JPEG, PNG or WebP within the size and pixel limits, and shorten an overlong filename before selecting it again. If validation or decoding fails, export a fresh copy or try another compatible browser. Generate the text again after changing the image or output form. A failed run clears the result, while a rejected file selection or cancellation can leave an older download visible. If Copy result fails, use the complete .txt download.
Frequently asked questions
Are my files uploaded?
No. The selected image is read and encoded in your browser. This tab can temporarily retain inputs and some results as you move between tools, subject to memory limits and expiry. Large or evicted results may need another run. Refreshing or closing the tab clears this workspace, so download anything you want to keep.
Should I use a data URL or Base64 only?
A data URL adds a prefix such as “data:image/jpeg;base64,” using the MIME type detected from the file bytes. PNG and WebP use image/png and image/webp. Base64 only omits that prefix. Both use standard Base64 with padding where needed, rather than Base64url. Neither mode creates an HTML tag or CSS rule; check that the receiving system accepts your chosen form and length. Decode the Base64 part to recover the complete original file bytes.
Does Base64 change or protect the image?
It encodes the original file bytes without resizing, recompressing or removing metadata. Stored dimensions, EXIF orientation, transparency and any embedded metadata remain in those bytes; the receiving application controls how the image looks. Base64 can be decoded by anyone who has the text, so it does not encrypt the file. The Base64 part has four characters per group of up to three input bytes; a data URL adds its prefix. Resize, compress or clean metadata in a separate copy before encoding if your destination needs a smaller or edited image.
Documentation & further reading
Related tools
WebP to JPG
Convert static WebP to JPG with a background color for transparent areas, then download.
PNG to JPG
Choose a background for transparent areas and save as JPG.
Batch JPG to PNG
Convert one or more JPG images to PNG files.
Image to WebP
Convert one or more JPG or PNG images to WebP with adjustable quality.