Base64 Encoder / Decoder
Encode or decode text and files, and see what a Base64 value really contains.
Free · No signupConverted in your browser
Change the format above, or paste Base64 here to decode it.
printf '%s' 'Hello, world!' | base64 | tr -d '\n'Use printf '%s' rather than echo: echo adds a newline that becomes part of the Base64.
Edit either side; the other updates as you type. Nothing leaves this page.
Secrets are not Base64
Keep server credentials encrypted with CtrlOps.
Keys and credentials are encrypted with AES-256 at rest and never leave your computer.
Keep it handy
Small inputs,
clear patterns.
Every 3 bytes become 4 characters. Watch the padding, the bytes in a non-English character and the newline that echo adds.
| Input | Base64 | What to notice |
|---|---|---|
Man | TWFu | 3 bytes become 4 characters |
Ma | TWE= | 2 bytes: one = of padding |
M | TQ== | 1 byte: two = of padding |
café | Y2Fmw6k= | é is 2 bytes in UTF-8 |
admin:secret | YWRtaW46c2VjcmV0 | An HTTP Basic auth header |
admin:secret\n | YWRtaW46c2VjcmV0Cg== | The same with echo’s newline |
How it works
Three bytes in.
Four characters out.
What Base64 does
Base64 writes any bytes using 64 safe characters: A–Z, a–z, 0–9, + and /. It takes 24 bits at a time and splits them into four 6-bit values, so images, keys and other binary data can travel through JSON, email, URLs and config files unchanged.
It encodes. It does not protect.
Anyone can decode Base64; there is no key. Kubernetes Secrets, HTTP Basic auth headers and many config files store values in Base64, which keeps them intact, not private. Use encryption or a secrets manager for anything sensitive.
Text is bytes first
Text is encoded to UTF-8 before it becomes Base64, so é is two bytes and an emoji is four. Quick snippets that call btoa() on a string fail on these characters; this tool handles any text.
URL-safe, padding and line breaks
URL-safe Base64 swaps + and / for - and _, as JSON Web Tokens do, and often drops the = padding. PEM files break lines every 64 characters and MIME email every 76. Choose the format above; decoding accepts all of them.
The newline from echo
echo secret | base64 encodes the word and a newline, giving c2VjcmV0Cg== instead of c2VjcmV0. That extra character breaks passwords stored in Kubernetes Secrets. Use printf '%s' secret | base64, as the terminal command above does.
Common questions
Base64,
explained.
Type or paste your text in the Text pane to see the Base64 on the right, or paste Base64 in the Base64 pane to decode it back to text on the left. Both panes convert live as you edit. For files, switch to File mode.
A variant that replaces the + and / characters with - and _ (and usually drops = padding) so the result is safe to use in URLs, query strings, filenames, and JWTs. Toggle the URL-safe alphabet in this tool; decoding accepts either variant automatically.
No. Base64 is an encoding, not encryption - it provides no security at all and anyone can decode it instantly without a key. Never use Base64 to hide passwords or secrets; use real encryption for that. Base64 only makes binary data safe to transport as text.
The = characters are padding. Base64 works in groups of 3 bytes (4 characters); when the input length is not a multiple of 3, one or two = are added so the output length is a multiple of 4. URL-safe Base64 often omits the padding.
Switch to File mode and choose your image - the tool shows both the raw Base64 and a ready-to-use data: URI (data:image/png;base64,...) that you can paste straight into CSS or an <img> src. Everything happens in your browser; the file is never uploaded.
Because they call btoa() on the raw string, which only handles Latin1 and throws or corrupts on accents, CJK, or emoji. The correct approach is to convert the text to UTF-8 bytes first, then Base64-encode those bytes - which is what this tool does, so Unicode round-trips exactly.
Keep exploring
Tools and guides for your next step.