Skip to content

Base64 Encode & Decode - Base64 Converter Online

Plain Text
Base64 Encoded

Encode and Decode Base64 Text

In Encode mode, type or paste text and get standard Base64 (with +, / and = padding). The text is converted to UTF-8 bytes first, so accented letters and emoji round-trip correctly; é encodes to w6k=. In Decode mode, paste Base64 and get the original text back. Whitespace and line breaks are ignored, so wrapped Base64 from emails or PEM files decodes without cleanup. Everything runs in your browser.

Examples

  • Hello encodes to SGVsbG8=.
  • user:pass encodes to dXNlcjpwYXNz, which is what goes after Authorization: Basic in an HTTP Basic Auth header. Decode a header value to check which credentials a client is sending.
  • The middle part of a JWT decodes to JSON claims. The JWT decoder does this for all three parts and checks expiry too.

Gotchas

  • Kubernetes Secrets. Values under data: are Base64. Encode without a trailing newline: echo -n secret | base64, not echo secret | base64, or your password will end in \n.
  • Data URIs. Remove the data:image/png;base64, prefix before decoding. Image data is binary, so it will not decode to readable text here; use the image to Base64 converter for images.
  • btoa in JavaScript. btoa("é") works but encodes the Latin-1 byte, giving 6Q== rather than the UTF-8 w6k=, and btoa("€") throws. Encode to UTF-8 bytes first with TextEncoder, which is what this tool does.

When to Use Base64

Base64 exists to move bytes through channels that only accept text: email attachments (MIME), JSON fields holding binary data, small images inlined in CSS, and keys in PEM files. It is not compression (it makes data bigger) and not protection. To check data integrity, use a hash; to put text in a URL, use URL encoding.

Related Tools

Frequently Asked Questions

Is Base64 encryption?
No. Base64 is a reversible encoding with no key, so anyone can decode it. A Kubernetes Secret or a Basic Auth header in Base64 is only hidden from casual reading. Treat the decoded value as if it were in plain text.
Why is Base64 output longer than the input?
Every 3 bytes become 4 characters, so output is about 33% larger: 4 × ceil(n / 3) characters for n bytes. "Hello" (5 bytes) becomes SGVsbG8=, 8 characters. Non-ASCII text grows more, because é is already 2 bytes in UTF-8 before encoding.
What do the = signs at the end mean?
Padding. Base64 works in groups of 3 bytes; if the input length is not a multiple of 3, one or two = are added. "Hi" is SGk=, "Hello!" (6 bytes) is SGVsbG8h with none. The decoder here accepts input with or without padding.
What is URL-safe Base64?
A variant (RFC 4648 section 5) that uses - and _ instead of + and /, and usually drops the = padding, so the result can go in URLs and file names unescaped. JWTs use it. You can paste URL-safe Base64 into Decode and it is handled automatically. The encoder always outputs standard Base64.
Why does decoding say the input is invalid?
Either the string contains characters outside the Base64 alphabet (often a stray quote, or the data:image/png;base64, prefix of a data URI), or the decoded bytes are not valid UTF-8 text. The second case means the Base64 holds binary data such as an image or a compressed file, which cannot be shown as text.