Base64 Encoder & Decoder
Encode text or an image to Base64, or decode a Base64 string back. Nothing you paste or upload ever leaves your browser.
Input type
Format:
Reference
Understanding Base64
Base64 turns arbitrary bytes, text or a whole image, into plain ASCII characters, so they survive being carried through systems built only for text.
- Base64
- A way to represent binary or text data using only 64 printable ASCII characters (A-Z, a-z, 0-9, +, /), plus = for padding. Common wherever raw bytes need to travel safely through a system built for text - email attachments, embedding a small image directly in HTML/CSS, API tokens, and more.
- Standard vs. URL-safe (Base64url)
- Standard Base64 uses + and / and pads with = - both characters have special meaning in a URL, so standard Base64 can't be dropped into a URL or filename as-is without encoding those characters again. URL-safe Base64 (RFC 4648) swaps + for -, / for _, and drops the = padding entirely - the variant JWTs and URL query parameters actually use.
- Why decoding can fail
- Not every string of text is valid Base64 - decoding fails if it contains a character outside the Base64 alphabet, or has the wrong length for its padding. This tool accepts either the standard or URL-safe alphabet when decoding, and ignores line breaks/whitespace (real Base64 is often wrapped at a fixed width), so most real-world Base64 pastes work without any cleanup first.
- Images too, not just text
- Switch to the Image tab to drop or upload an image (PNG, JPEG, GIF, WebP, or BMP) and get its ready-to-use Base64 Data URI - the exact string you can paste straight into an <img src="..."> or a CSS url(...). Pasting a Data URI, or a bare Base64 string that decodes to one of those formats, into that same tab is auto-detected in reverse - a real preview appears automatically, with the format, pixel dimensions, and file size shown. SVG isn't detected yet - it's a text/XML format, not one of the binary signatures this tool currently checks for.
- Data URI
- A self-contained string like data:image/png;base64,iVBORw0K... - the MIME type and the Base64-encoded bytes together in one value, with no separate file needed. Directly usable anywhere a URL is expected: an <img> tag's src, a CSS background-image, a JSON payload, and more.
- Why this stays private
- Encoding and decoding Base64 - text or images - doesn't need a server at all. Your browser already has everything required built in, including reading a dropped/uploaded file. Nothing you paste or upload here is ever sent anywhere.