Skip to content
OpsKit

Base64 Encoder / Decoder

Convert text to Base64 and back. Handles non-ASCII text correctly, supports the URL-safe alphabet used by JWT, and tells you when the payload is binary rather than quietly mangling it.

Output

Runs entirely in your browser. This page is a static file. Whatever you type stays in the tab, is never sent to a server, and is gone when you close it — so pasting a real token or config is safe.

When you reach for this

  • Reading a Kubernetes Secret, where every value is Base64 and kubectl get secret shows you the encoded form.
  • Embedding a small image or certificate into a config file, an environment variable, or a data URI.
  • Inspecting an Authorization header, a webhook payload or a JWT segment that arrived Base64-encoded.

Worked examples

Plain ASCII

Input
hello world
Result
aGVsbG8gd29ybGQ=

The trailing = is padding, not part of the data.

Non-ASCII text

Input
안녕하세요
Result
7JWI64WV7ZWY7IS47JqU

Each Hangul character becomes 3 UTF-8 bytes. Tools that use btoa() throw an error here.

URL-safe, for a JWT segment

Input
{"alg":"HS256","typ":"JWT"}
Result
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9

No padding and no + or / characters, so it survives being placed in a URL.

Where people get this wrong

Assuming Base64 is encryption

It is an encoding, fully reversible by anyone. A Kubernetes Secret is Base64-encoded, not protected — treat its contents as plaintext in your threat model.

Feeding URL-safe Base64 to a standard decoder

JWT segments use - and _ and drop padding. A strict standard decoder rejects them. Convert the alphabet and re-pad to a multiple of 4 first.

Losing bytes to a trailing newline

echo "secret" | base64 encodes a trailing newline too. Use echo -n or printf when the value must match exactly.

Frequently asked questions

Why is my encoded string longer than the original?

Base64 represents 3 bytes with 4 characters, so output grows by roughly 33%, plus padding. That overhead is the cost of moving binary data through a text-only channel.

Is it safe to paste a production secret here?

The page is static and the conversion happens in JavaScript in your tab. Nothing is transmitted. You can verify this by opening your browser's network panel while you type.

How do I do this in a terminal instead?

Encode with printf '%s' 'text' | base64 and decode with base64 -d. On macOS the decode flag is -D. For URL-safe output add | tr '+/' '-_' | tr -d '='.

Related tools