Image to Base64 Converter
Upload or drag and drop an image to generate a Base64 data URI string, with one-click copy support.
FAQ
What is Base64?
Base64 is a method of encoding binary data into printable ASCII characters. The encoded string contains only A-Z, a-z, 0-9, +, / and = (padding character). It's commonly used to safely embed images and other binary data in text protocols like HTML, CSS, and JSON.
When should I use Data URI?
Data URIs are ideal for embedding small images directly in HTML or CSS to reduce HTTP requests. Common use cases include: small icons, CSS background images, and embedding images in emails. However, Base64 encoding increases file size by approximately 33%, so it's not suitable for large images. We recommend using Data URI embedding for images under 10KB.
What's the difference between Data URI and raw Base64?
A Data URI is the complete format, e.g., data:image/png;base64,iVBORw0KGgo..., which can be used directly in HTML src attributes or CSS url() functions. Raw Base64 contains only the encoded string portion without the prefix, suitable for scenarios where you need to construct the prefix yourself.
Related guide
UUID, QR Code and Base64: Where Three Generators Stop Telling You They Failed
The UUID page draws real entropy from crypto.getRandomValues, but its count box turns 0 and abc into ten and ignores your format checkboxes until you press Generate again. The QR generator has no error path: ask for more than the error-correction level can hold and it leaves you an invisible canvas that the Download button still exports as a 2,786-byte PNG. The Base64 page trusts your browser's MIME guess, never shows gigabytes, and marks its preview box ready for files it cannot preview. All figures measured by driving the pages.