Base64 Encoder

Base64 Encoder

Encode any text or string to Base64 instantly in your browser. Supports UTF-8, shows character count and output payload size. Free, no signup, 100% client-side.

Updated May 2026

Shift + Enter to Copy · Shift + for tabs
Input String
0 characters
Base64 Output
Speed
Privacy
Local Only
Size
0 KB

How this base64 encoder works

Text or file, three steps

1. Paste text or drop a file

Switch to Text mode to paste any string, or File mode to drag in a PDF, XLSX, DOCX, ZIP, or image.

2. See the result instantly

The Base64 string appears right away, with a green valid badge once it's ready.

3. Copy it

One click on Copy (or Shift+Enter) sends the output straight to your clipboard.

What this base64 encoder can do

More than plain text

Encodes UTF-8 text correctly

Uses encodeURIComponent combined with btoa, so accented letters, CJK characters, and emoji don't break like they would with plain btoa().

Encodes any file type

Drop a PDF, XLSX, DOCX, ZIP, or image up to 50 MB — it's read locally, nothing gets uploaded to a server.

Runs 100% in your browser

Nothing leaves your device — encoding happens locally, and the page keeps working offline once it's loaded.

Output ready to paste into an API

The result is a raw Base64 string, identical to what server-side base64_encode() would produce.

Examples

Text and files, side by side

Input
Base64 output
Hello
SGVsbG8=
hello world
aGVsbG8gd29ybGQ=
{"user":"admin"}
eyJ1c2VyIjoiYWRtaW4ifQ==
café
Y2Fmw6k=
(PDF file)
JVBERi0x... — ready to paste into an API payload

When you'll reach for this

The most common scenarios among people who use this tool

Attach a PDF to JSON

Payment and e-signature APIs often expect a base64_content field somewhere in the request body.

Spreadsheet into an API payload

Finance and reporting systems frequently accept Excel files as a Base64 string instead of a multipart upload.

Basic Auth header

The username:password pair gets Base64-encoded before it goes into the Authorization header.

Inline image in HTML or CSS

Data URIs (data:image/png;base64,...) skip an extra network request for small icons and logos.

Debugging a JWT

Encode JSON to check exactly what a token segment should look like before you sign it.

Secrets in a .env file

An encoded certificate or private key travels as a single-line string in any config file or CI secret.

Not what you expected? Start here

Double encoding

Never encode an output that's already Base64 — always start from the original raw value, or you'll get garbage on decode.

Base64 vs Base64URL

Standard Base64 uses + and /; URL-safe swaps them for - and _. The two are not interchangeable.

Mistaking it for encryption

Base64 is encoding, not security — anyone can decode it instantly with no key required. Never use it to protect passwords or secrets.

Skipping the UTF-8 step

Plain btoa() breaks on anything outside Latin-1 — this tool already handles that for you.

Why encode here

Everything runs locally in your browser — no byte of your text or file ever leaves your device, and the page keeps working offline once it's loaded.

Unlike plain btoa(), this tool already handles UTF-8 correctly and accepts whole binary files up to 50 MB, not just short strings — and the output is always standard Base64, identical to what any server-side library produces, so there are no surprises when you paste it into your API.

Frequently asked questions

Yes — switch to File mode, drop the PDF, and copy the output. The result is a raw Base64 string ready to paste into any API payload.

References

Related Tools