Skip to content

Base64 Encoder / Decoder

Encode or decode text and files, and see what a Base64 value really contains.

Free · No signupConverted in your browser

Alphabet
Line breaks

Change the format above, or paste Base64 here to decode it.

Linux · macOS
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.

Explore SSH securityDownload for MacDownload for Windows

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.

Example inputs and their Base64
InputBase64What to notice
ManTWFu3 bytes become 4 characters
MaTWE=2 bytes: one = of padding
MTQ==1 byte: two = of padding
caféY2Fmw6k=é is 2 bytes in UTF-8
admin:secretYWRtaW46c2VjcmV0An HTTP Basic auth header
admin:secret\nYWRtaW46c2VjcmV0Cg==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.

Read RFC 4648, the Base64 standard

Common questions

Base64,
explained.

Keep exploring

Tools and guides for your next step.

Your privacy preferences. We use product analytics to improve CtrlOps. Google measurement runs without analytics cookies. Live chat stays off until you allow it. Cookie policy