Loading tool…
About the Base64 Encoder / Decoder
Base64 turns arbitrary bytes into ASCII text so they can travel safely through systems that only handle text — email attachments, JSON fields, URLs, Basic Auth headers. This tool encodes and decodes both directions locally.
How to use the Base64 Encoder / Decoder
- Choose Encode or Decode.
- Paste your text (or Base64 string) into the input box.
- The result updates as you type.
- Copy the output with one click.
Step-by-step walkthrough with examples and the errors people hit: How to Base64 Encode and Decode Text.
Example
Encode
hello world→
aGVsbG8gd29ybGQ=
Decode
aGVsbG8gd29ybGQ=→
hello world
Common errors and how to fix them
Not valid Base64 input
The text contains characters outside A–Z, a–z, 0–9, + and / (or - and _ for URL-safe), or its length is not a multiple of four without padding. Whitespace and line breaks inside the string are common culprits.
Decoded text shows odd symbols
The bytes were not UTF-8 text, for example an image or a compressed blob. Base64 carries any bytes; only text decodes to readable characters.
More problems and fixes in the tutorial
What Base64 is, and what it is not
Base64 represents any sequence of bytes using 64 printable ASCII characters (A–Z, a–z, 0–9, + and /) plus = for padding. It exists so binary data can travel through systems designed for text: email attachments, JSON fields, HTTP headers, XML, and URLs. It is an encoding, not encryption. Anyone can decode it in a second, which is precisely what this page does, so never treat a Base64 string as a secret.
Encode and decode text, including UTF-8
Type or paste in the input and switch between Encode and Decode; the output updates as you type. Text is treated as UTF-8, so accented characters, CJK scripts and emoji round-trip correctly, unlike the browser's built-in btoa, which only handles Latin-1. Decoding accepts standard Base64 and the URL-safe alphabet (with - and _ instead of + and /), with or without padding.
Where you meet Base64 every day
HTTP Basic authentication sends user:password Base64-encoded in the Authorization header. JSON Web Tokens are three Base64url segments joined by dots. Kubernetes stores Secret values Base64-encoded in manifests, which is why kubectl get secret shows unreadable strings. Data URLs embed images in CSS and HTML as data:image/png;base64,…. Email attachments and MIME parts are Base64 under the hood. In every one of these cases, decoding is how you see what is actually there.
Padding, line breaks and the URL-safe variant
Encoded output is always a multiple of four characters; one or two = signs pad the end when the input length is not a multiple of three. Some producers omit the padding (JWTs do) and some wrap lines every 76 characters (MIME does). Both decode here. The URL-safe alphabet from RFC 4648 §5 swaps the two characters that have special meaning in URLs, so a token can sit in a query string without percent-encoding.
Privacy
Encoding and decoding run in your browser; nothing is sent to a server. Even so, a Base64 string in the wild is often a credential: decode it here, but treat the result with the care the original deserves.
FAQ
Is Base64 encryption?
No. Base64 is an encoding, not encryption — anyone can decode it. Never use it to hide secrets.
Why did decoding fail?
The input isn’t valid Base64 — it must only contain A-Z, a-z, 0-9, +, /, and = padding, with a length that’s a multiple of 4.
Does this support UTF-8 text?
Yes, multi-byte UTF-8 characters (emoji, accented letters, non-Latin scripts) are handled correctly in both directions.
How do I decode a Kubernetes secret?
Copy the value from kubectl get secret name -o yaml and decode it here, or on the command line: kubectl get secret name -o jsonpath="{.data.key}" | base64 -d.
Can I encode a file or an image to Base64?
This page handles text. For a file, use your shell: base64 image.png > image.txt on Linux and macOS, or [Convert]::ToBase64String([IO.File]::ReadAllBytes("image.png")) in PowerShell.
Why is Base64 output about a third longer than the input?
Every 3 bytes become 4 characters, so encoded data is 4/3 the size, plus up to two padding characters.
What is the difference between Base64 and hex?
Both represent bytes as text. Hex uses 16 symbols and doubles the size; Base64 uses 64 and adds a third. Hex is easier to read byte by byte; Base64 is more compact, which is why transports prefer it.