Convert Image to Base64 Online
Encode any image as a Base64 data URL online — browser-based, no upload.
Base64 encoding converts binary image data into a text string that can be embedded directly in HTML, CSS, JSON, or any text-based format. This is useful for embedding small images inline in web pages without an extra network request, storing images in JSON APIs, or generating data URLs for use in code. Dockitt converts your image to a base64 data URL entirely in your browser using the FileReader API.
How to use
- Click 'Choose Image' and select any image file.
- Click 'Convert to Base64' and wait while the image is encoded.
- Download the .txt file containing the full data URL.
FAQ
What is a base64 data URL?
A data URL encodes binary file data as a base64 text string with a MIME type prefix, formatted as: data:image/png;base64,iVBORw0... This string can be used directly as the src of an HTML <img> tag, as a CSS background-image value, or embedded in JSON payloads.
Can I embed the output directly in an HTML page?
Yes. Copy the contents of the downloaded .txt file and use it as the src attribute of an <img> element: <img src='data:image/png;base64,ABC...' />. This embeds the image directly in the HTML without a separate file.
Will the base64 string be much larger than the original image?
Yes. Base64 encoding increases data size by approximately 33% compared to the binary source. A 100KB image produces a base64 string of about 133KB. For large images, consider using a file reference instead of embedding the data URL.
Is the conversion done in my browser or on a server?
The conversion uses the browser's FileReader API. Your image is never uploaded to any server.