Base64 Decode and Encode
Decode Base64 to text or images and encode text or files to Base64, with UTF-8, URL-safe base64url, and data URLs. Everything runs in your browser.
Open source on GitHubText or file to encode
Base64 output
Runs entirely in your browser. Nothing you paste here is uploaded or stored.
How Base64 encoding works. Three bytes in, four characters out.
| Step | What happens |
|---|---|
| 1. Bytes | Text is first turned into bytes. This tool uses UTF-8, so “é” becomes 2 bytes and most emoji become 4. |
| 2. Groups of 3 | The bytes are split into groups of 3 (24 bits). |
| 3. Four 6-bit values | Each 24-bit group is read as four 6-bit numbers from 0 to 63. |
| 4. Alphabet | Each number maps to one of 64 characters: A–Z, a–z, 0–9, then + and / (or - and _ in base64url). |
| 5. Padding | If the last group has 1 or 2 bytes, the output ends with “==” or “=” so its length is a multiple of 4. |
Base64 variants. Which alphabet and padding each format uses.
| Variant | Alphabet | Padding | Used in |
|---|---|---|---|
| Standard (RFC 4648 §4) | A–Z a–z 0–9 + / | Required (=) | MIME email, PEM certificates, most APIs |
| URL-safe base64url (RFC 4648 §5) | A–Z a–z 0–9 - _ | Usually omitted | JWTs, URLs, filenames, WebAuthn |
| Data URL | Standard alphabet after data:<type>;base64, | Required | Inline images and fonts in HTML and CSS |
| MIME (RFC 2045) | Standard alphabet, lines wrapped at 76 characters | Required | Email attachments |
More free tools. Free, open source, no sign-up. See all tools · Source on GitHub
Frequently asked questions
What is Base64 encoding?
Base64 is a way to represent binary data as plain text using 64 safe characters. Every 3 bytes become 4 characters, so the output is about 33% larger than the input. It is used wherever binary data must travel through text-only channels: email attachments, JSON payloads, data URLs, HTTP Basic auth headers, and JWTs.
Is Base64 encryption?
No. Base64 is an encoding, not encryption. Anyone can decode it without a key, so never use it to hide passwords, API keys, or personal data. Use real encryption (for example AES-GCM) or hashing where secrecy matters.
Why does my decoded Base64 show strange characters?
Either the data is binary (an image, PDF, or compressed file) rather than text, or it was encoded with a different character set. This tool decodes as UTF-8 and switches to a hex view with a download button when the bytes are not valid text. Images are detected from their file signature and previewed.
What is the difference between Base64 and base64url?
base64url replaces + with - and / with _, and usually drops the = padding, so the result can be used in URLs and filenames without escaping. JWTs use base64url. This decoder accepts both alphabets, with or without padding.
How do I convert an image to Base64?
Choose “File to base64” and pick the image. The tool reads it in your browser and outputs a data URL such as data:image/png;base64,iVBOR…, which you can paste into an <img src> attribute or a CSS url(). Turn off the data URL prefix to get only the raw Base64. Files never leave your device.