Base64 data URLs
A data URL is a way of embedding content directly inside a URL. You’ll often see it for small images, inline SVGs, or test payloads.
The pattern
data:<mime-type>;base64,<base64-bytes>If you paste a full data URL into the Base64 tool, it’ll automatically strip the prefix and decode it.
Common examples
PNG image
data:image/png;base64,iVBORw0KGgo…
JSON payload
data:application/json;base64,eyJoZWxsbyI6IndvcmxkIn0=
Extracting the MIME type
The part after data: and before ;base64, is the MIME type.
// dataUrl: string
const match = dataUrl.match(/^data:([^;,]+)?;base64,(.*)$/i);
const mime = match?.[1] ?? null;
const b64 = match?.[2] ?? '';K-Tools does this automatically when you paste a data URL into the decoder.
When decoding looks like garbage
Base64 is often used to encode binary bytes (images, PDFs, etc). If you decode bytes and try to display them as text, it can look corrupted. In that case, use “download bytes”.
Related: Base64 tool · Decode Base64 to image
Continue with related guides
Browse the full guides hub or open the Base64 encode/decode tool.