Base64 Decode and Encode
Runs locallyEncode and decode Base64 and Base64URL, text or files, as you type.
Text
Drop any file here to get its Base64 and a data: URI. It is read in this tab and never uploaded.
Base64
72 characters
Base64 is a way to carry bytes through text, not a way to hide them
Base64 (RFC 4648) turns every 3 bytes into 4 characters from a 64-letter alphabet, so binary data can travel through systems that only handle text: JSON fields, HTTP headers, email bodies, data: URIs. Anyone can reverse it; it is an encoding, not encryption. The output is always about 33% larger than the input, because 6 bits of payload ride in every 8-bit character.
There are two alphabets. Standard Base64 uses + and / and pads with =. Base64URL (RFC 4648 §5) swaps in - and _ so the result is safe in URLs and filenames, and usually drops the padding — which is what JWTs, WebAuthn and many APIs use. This page reads either alphabet when decoding and detects which one you pasted; to decode a whole token rather than one segment, open it in the JWT decoder.
Text is always converted to UTF-8 bytes before encoding, which is why an emoji or an accented letter works here while the browser’s own btoa() throws. The formal definition is in RFC 4648.
Text
café ☕
Base64 and Base64URL
Base64 Y2Fmw6kg4piV
Base64URL Y2Fmw6kg4piV
"ü?" → w7w/ (standard)
→ w7w_ (URL-safe)The first string has no + or /, so both alphabets agree. "ü?" encodes to a / in standard Base64, which becomes _ in Base64URL — the only difference between the two.
Where people get caught
Garbled characters after decoding
The bytes decoded fine but were not UTF-8 — often Latin-1 or UTF-16 text from an older system. Decoding them as UTF-8 produces é where é should be. The tool shows binary data instead of guessing when the bytes are not valid UTF-8.
Mixing the two alphabets
A standard decoder rejects - and _, and a strict URL-safe decoder rejects + and /. If a token fails to decode, check which alphabet the producer used before assuming it is corrupt.
Missing or extra padding
Base64URL usually omits =, and some decoders insist on it. Length is the tell: a valid unpadded string is never 1 more than a multiple of 4 characters.
Line breaks from MIME and PEM
Email and certificate formats wrap Base64 at 64 or 76 characters. The line breaks are not part of the data; this decoder ignores whitespace, but some libraries do not.
Using Base64 to "secure" a value
Basic auth headers, Kubernetes Secrets and many config files store Base64, which anyone can decode. Treat the value as plain text when deciding who may see it.
About Base64 encoding
How it works in 4 steps · 4 common use cases · 5 questions answered
About Base64 encoding
How it works in 4 steps · 4 common use cases · 5 questions answered
How it works
- 1.Type or paste. Input that looks like Base64 switches the direction to Decode automatically.
- 2.Base64URL is detected from - and _ or missing padding; tick the box to force it.
- 3.Drop a file to encode its bytes and get a data: URI.
- 4.Decoded bytes that are not text are identified (PNG, JPEG, PDF…), previewed if they are an image, and offered as a download.
Common use cases
- •Reading a Base64 value from a Kubernetes Secret or a config file
- •Turning an icon into a data: URI for CSS or an email
- •Decoding one segment of a JWT or a WebAuthn payload
- •Checking what an API returned in a Base64 field
FAQ
Is Base64 encryption?
No. It is a reversible encoding with no key; anyone with the string can decode it. Use it to carry data, and encryption (or no storage at all) to protect it.
Why is Base64 about 33% larger?
Each output character carries 6 bits, so 3 bytes (24 bits) become 4 characters. Padding can add up to two more characters at the end.
What is Base64URL?
The URL- and filename-safe variant from RFC 4648 §5: - and _ replace + and /, and the = padding is usually left off. JWTs and many web APIs use it.
Why do I see garbled characters after decoding?
The original text was not UTF-8, or the data is binary. When the bytes are not valid UTF-8 this tool reports binary data and offers a download instead of showing mojibake.
How do I turn an image into Base64?
Drop the image onto the input or use Upload. You get the raw Base64 and a complete data:image/…;base64 URI ready to paste into HTML or CSS.
Related tools
- JWT DecoderA JWT is three Base64URL segments — decode all of them at once
- URL Encode / DecodePercent-encode Base64 before it goes into a query string
- Hash GeneratorGet a digest as Base64 instead of hex
- HTML EntitiesEscape text for HTML rather than for transport
- JSON EscapeEscape a string for a JSON literal instead