Base64 Encoder / Decoder
Encode plain text to Base64 or decode Base64 strings back to readable text.
Did this tool work for you?
How to use this calculator
- 1
Choose Encode or Decode mode.
- 2
Enter your text (for encoding) or Base64 string (for decoding).
- 3
The result appears instantly.
Frequently asked questions
Is Base64 a way to protect data?
No. It is an encoding with no key, and anyone can reverse it, including with this tool. The Basic authentication header, for instance, is just Base64 of "user:password" (RFC 7617), which is why it is only safe over HTTPS. Never treat a Base64 string as hidden or encrypted.
How are non-English characters encoded?
The text is first converted to UTF-8 bytes, and the bytes are then encoded. That follows what most APIs expect. "café ☕" is 9 bytes in UTF-8 and encodes to Y2Fmw6kg4piV. Decoding assumes UTF-8 as well, so Base64 made from text in another character set may not decode to readable text.
Why do I get "Valid Base64, but not UTF-8 text"?
The string decoded fine but the bytes are not text. Examples: iVBORw0KGgo= begins every PNG image, and a signature in a JWT is raw bytes. Base64 of Latin-1 text is another case: Y2Fm6Q== decodes to the bytes c, a, f and E9, where E9 is é in Latin-1 but invalid in UTF-8. This tool decodes text only, not files.
Does the decoder accept URL-safe Base64 and missing padding?
Yes. The URL-safe alphabet from RFC 4648 uses - and _ instead of + and /, and the decoder converts them. It also adds missing = padding, so SGVsbG8sIFdvcmxkIQ decodes the same as SGVsbG8sIFdvcmxkIQ==. Spaces and line breaks inside the string, such as the 76-character wrapped lines in email, are ignored. The encoder always writes the standard alphabet with padding.
Can I decode a JWT with this?
The first two dot-separated parts of a JWT (header and payload) are Base64URL-encoded JSON, so you can paste each one separately and read them. eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9 decodes to {"alg":"HS256","typ":"JWT"}. The third part is a binary signature and will give the not-UTF-8 message. Decoding does not verify the token.
Why is the encoded text longer than the input?
Every 3 input bytes become 4 output characters, so output length is 4 × ceil(bytes ÷ 3), roughly one third bigger, and short inputs grow more because of = padding. The size figure compares UTF-8 bytes, not characters, so accented text is measured fairly.
What makes decoding fail?
Characters outside the Base64 alphabets, such as * or !, or a length that cannot be valid (one extra character after complete 4-character groups). The tool names the problem rather than guessing. A trailing newline or space does not matter.
Base64 encoding and decoding of text
How the 3-to-4 mapping works
Base64, defined in RFC 4648, reads input three bytes (24 bits) at a time and writes four characters of six bits each from an alphabet of A-Z, a-z, 0-9, + and /. When the input is not a multiple of three, the output is padded with one or two = signs. Because the input to this tool is text, it is first turned into UTF-8 bytes.
| Text | Bytes | Base64 | Output length |
|---|---|---|---|
| a | 1 | YQ== | 4 |
| ab | 2 | YWI= | 4 |
| abc | 3 | YWJj | 4 |
| Hello, World! | 13 | SGVsbG8sIFdvcmxkIQ== | 20 |
Worked examples
Encoding "Hello, World!" gives SGVsbG8sIFdvcmxkIQ==, which is 20 characters for 13 bytes, a 53.8% increase because small inputs carry the padding overhead. Encoding "admin:s3cret" gives YWRtaW46czNjcmV0, the form used after "Basic " in an HTTP Authorization header. Decoding Y2Fmw6kg4piV returns "café ☕". Decoding the string without padding, SGVsbG8sIFdvcmxkIQ, returns the same "Hello, World!".
Where Base64 shows up
Email attachments use it through MIME, data URIs embed small images in HTML and CSS, and JSON APIs use it to carry binary values as strings. JWTs use the URL-safe variant, without padding, for their header and payload. In every case it solves a transport problem, text-only channels that cannot carry raw bytes, and provides no secrecy.
What this tool does not do
It does not read files, so you cannot paste in an image and get its Base64 here, and it cannot show binary output as text: such results produce an error that states how many bytes were decoded. It does not produce URL-safe output and it does not check signatures or checksums. When a decoded result looks like gibberish, the source was probably binary or in a character set other than UTF-8.
Planning for the size increase
Encoded size is 4 × ceil(n ÷ 3) characters for n bytes, so 1,000 bytes become 1,336 characters and a megabyte becomes about 1.33 MB. Embedding a large file as a data URI therefore costs a third more than the file itself and cannot be cached separately from the page. Line-wrapped Base64, as produced by email software, is also accepted by the decoder, because it strips whitespace before decoding.
Learn more from an authoritative source:
MDN Web DocsURL Encoder / Decoder
Encode special characters in URLs (percent-encoding) or decode percent-encoded URLs.
UUID Generator
Generate UUID v4 (random) identifiers — one or in bulk.
Unix Timestamp Converter
Convert Unix timestamps to human-readable dates and times, and vice versa.
JWT Decoder
Decode and inspect JWT (JSON Web Token) headers and payloads without verifying the signature.
Cron Expression Generator
Generate and explain cron expressions — pick a preset or write your own.
Slug Generator
Convert any title or phrase into a clean URL slug — lowercase, hyphenated, SEO-friendly.
Results are estimates for informational purposes only and do not constitute professional financial, medical, legal, or technical advice. Read full disclaimer →