Base64 Encode / Decode
Encode any text to Base64 or decode a Base64 string back to plain text. Full UTF-8 support and a URL-safe (base64url) mode make it reliable for tokens, data URIs, and HTTP headers.
About the Base64 Encode / Decode
Base64 encodes arbitrary binary data using only 64 printable ASCII characters, so it can travel safely through systems built for text — email, JSON, HTTP headers, and data URIs. It is an encoding, not encryption: anyone can decode it, so it provides no confidentiality on its own.
The URL-safe variant (base64url) swaps the + and / characters for - and _ so the result can sit inside a URL or filename without escaping. JWTs, OAuth tokens, and many web APIs use this variant, which is why having both modes in one tool is handy.
Mechanically, Base64 regroups input into 6-bit chunks — 3 bytes of input become 4 output characters, each mapped to one of 64 symbols (A–Z, a–z, 0–9, + and /, or - and _ in the URL-safe form). When the input length isn't a multiple of 3, the output is padded with one or two = characters to complete the final 4-character group. This 6-bit-per-character packing is also why Base64 output is always about 33% larger than the original data — it trades size for being safely representable as plain text.
The format was formalized for email attachments in MIME (RFC 2045) in the early 1990s, so 8-bit binary files could travel through mail systems built only to carry 7-bit ASCII text. The current specification is RFC 4648, which also defines Base32 and the base64url variant used by JWTs and other web-safe encodings. Today it shows up constantly outside email too — data URIs that embed images directly in CSS or HTML, the header and payload segments of a JWT, and the credentials in an HTTP Basic Authorization header are all Base64 under the hood.
How to use it
- 1Paste plain text to encode it, or a Base64 string to decode it.
- 2Toggle URL-safe mode if you are working with base64url tokens.
- 3Copy the converted output with a single click.
Features
- Encode and decode in one place, switching instantly
- Correct UTF-8 handling for emoji and non-ASCII text
- URL-safe base64url variant (-/_ instead of +/) for tokens and URLs
- One-click copy of the result
Frequently asked questions
Is Base64 encryption?
No. Base64 is reversible encoding, not encryption. Anyone can decode it, so never use it to protect secrets — use real encryption for that.
What is the difference between Base64 and base64url?
base64url is a URL-safe variant that replaces the + and / characters with - and _ and usually drops padding, so the value is safe inside URLs and filenames. JWTs use base64url.
Does it support UTF-8 and emoji?
Yes. The tool encodes text as UTF-8 before Base64, so non-ASCII characters and emoji round-trip correctly.
Is my data private?
Yes. Encoding and decoding happen entirely in your browser; nothing is sent to a server.
Why is my Base64 output longer than the original text?
Base64 packs input into 6-bit groups instead of the usual 8-bit bytes, so every 3 bytes of input become 4 characters of output — an unavoidable ~33% size increase in exchange for being safe to put in plain-text formats.
What does the = padding at the end mean, and can I remove it?
= characters pad the final group when the input length isn’t a multiple of 3 bytes, so the output length is always a multiple of 4. Standard Base64 keeps the padding; the base64url variant (and this tool’s URL-safe mode) conventionally drops it, since the decoder can infer it from the string length.
How do I Base64 encode or decode in code?
Most languages ship it in the standard library: JavaScript has btoa()/atob() (ASCII only — encode UTF-8 text with new TextEncoder() first, as this tool does), Python has the base64 module (base64.b64encode / b64decode), and most other languages have an equivalent built-in encoder.
Can I encode a file or image, not just text?
This tool is for text. To Base64-encode an image or other file, use the dedicated Image to Base64 tool, which also generates a ready-to-use data: URI.