HCODX/Base64 Encode
100% browser-based · UTF-8 safe · URL-safe variant

Base64 Encode

Encode text to Base64 in your browser. UTF-8 safe, URL-safe variant available, line-wrap to 76 columns or none. Uses the browser's native btoa after UTF-8 encoding — no upload, no server round-trip.

Plain text
Base64 output
Encode options
Reverse (Base64 → Text)
Input size
0 B
Output size
0 B
Ratio
Status
Ready
Example

Text in, Base64 out

Base64 expands input by roughly 33% — every 3 bytes of input become 4 characters of output. Unicode multiplies first via UTF-8.

Plain text
Hello, world!
Base64
SGVsbG8sIHdvcmxkIQ==
Use cases

What you'll use this for

Base64 is the lingua franca of "binary over text" channels — embed bytes inside JSON, HTTP, URLs, email, or environment variables.

HTTP basic auth

Encode user:password for an Authorization header without writing code.

Data URIs

Embed small images directly in CSS or HTML via data:image/png;base64,....

Email attachments

MIME wraps binary attachments in Base64 with 76-char lines — toggle that here.

Kubernetes secrets

Encode values for kubectl create secret manifests directly.

Step by step

How to Base64-encode text

1

Paste your text

Drop it into the left editor. Unicode is fine — it's UTF-8 encoded first, then Base64 wraps the bytes.

2

Pick variant

Standard for most uses. URL-safe (- and _ instead of + and /) for JWTs and URLs.

3

Click Encode

Or leave auto-encode on for live updates. Runs locally — no upload.

4

Copy or download

Copy to clipboard or save as .txt. Or jump straight to the decoder for round-trip checks.

FAQ

Frequently asked questions

No. Base64 is a binary-to-text encoding for safe transport in text-only channels (HTTP headers, JSON, email). It is fully reversible without a key. Anyone with the Base64 string can decode it.

Yes. Input is encoded as UTF-8 first via TextEncoder, then those bytes go through Base64. Round-tripping back through the decoder reproduces the original Unicode string.

RFC 4648 §5 replaces + with - and / with _, so the output is safe in URLs and filenames. JWTs use this variant. Toggle it under Variant.

Base64 maps every 3 input bytes to 4 output characters — a ~33% size increase. Plus optional padding (=) to round to multiples of 4.

Yes. No signup, no limits, no ads. Runs entirely in your browser.

About

About Base64 encoding

Base64 (RFC 4648) is a binary-to-text encoding that uses 64 printable ASCII characters: A-Z, a-z, 0-9, plus + and / (or - and _ for the URL-safe variant). It's used wherever raw bytes need to ride through text-only channels.

How encoding works

  • Each 3 input bytes (24 bits) become 4 output characters (4 × 6 bits).
  • If the input length isn't a multiple of 3, padding = (or ==) is appended.
  • Unicode strings are UTF-8 encoded first, then the byte stream is Base64'd.

When to use which variant

  • Standard — HTTP headers, email (MIME), most APIs.
  • URL-safe — JWTs, query strings, file names, anywhere +// would conflict.
  • No padding — JWTs strip = for compactness; some APIs require it.
Related

Related tools