Image to Base64
Convert any image to a Base64 encoded data URI for embedding in HTML or CSS.
Click or drag an image file here
1 image · Max 2MBImage to Base64
This tool converts an image file into a Base64 encoded data URI string. You can embed this string directly in HTML or CSS, eliminating the need for a separate image file request.
Base64 encoding increases the data size by approximately 33%, so it's best used for small images like icons and logos rather than large photographs.
How to use
- Drag and drop an image file onto the upload area, or click to select.
- The Base64 encoded data URI appears in the text editor below.
- Use Copy to copy the result or Save to download as a text file.
Embedding images in HTML
You can use Base64 data URIs directly in HTML img tags:
<img src="data:image/png;base64,ivborw0kggo..." width="300" height="100" alt="base64 image"/>
/* In CSS */
.logo {
background: url('data:image/png;base64,ivborw0kggo...');
}
Convert with Python
Convert an image to Base64 using Python:
import base64
with open('image.png', 'rb') as f:
encoded = base64.b64encode(f.read())
data_uri = 'data:image/png;base64,' + encoded.decode()
MCP integration
MCP (Model Context Protocol) lets AI agents and apps discover and run Coding.Tools utilities for repeatable conversions, formatting, hashing, and generation workflows.
MCP tool name: image-to-base64
MCP endpoint: https://coding.tools/mcp
Call tools/list first. Each tool entry includes inputSchema, outputSchema, and examples so an AI agent or client can build valid arguments without guessing.
For tools/call, read result.content[0].text for the display value and result.structuredContent for machine parsing. Tool-level failures return isError: true; protocol failures return a JSON-RPC error.
Example tools/call request:
curl -s https://coding.tools/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "MCP-Protocol-Version: 2025-06-18" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"image-to-base64","arguments":{"input":{"url":"https://coding.tools/assets/img/photo2pixel-demo.png"}}}}'
For image-to-base64, pass a public image URL as input.url. For private local files, use the web UI or send the file bytes as Base64 with options.mimeType.
Most text and data tools accept an input string plus optional options. Browser-only image tools are listed for discovery and return a web UI link when they need browser image APIs.