Encode and decode Base64 in seconds. Nothing leaves your browser.

Paste text or a file, get Base64 back — or paste Base64 and get the original back. URL-safe mode included.

  • 100% client-side — verifiable
  • Text + files, both directions
  • URL-safe (base64url) mode
  • No sign-up, no limits

Encode text to Base64 or decode Base64 to text

Try:

Options

Text is always converted as UTF-8 bytes first, so accented letters, Chinese, Arabic, and emoji round-trip correctly — unlike the old btoa() shortcut, which fails on anything outside Latin-1.

File → Base64

Turn any file (image, PDF, ZIP, up to 10 MB) into Base64, ready to paste into a data URI, JSON payload, or API request.

Drag & drop a file here

or browse your files — the file is read on your device only

Base64 → file

Paste a Base64 string and download the original file — useful for Base64 images, PDFs, and attachments from APIs and emails.

Rename the file to the right extension (for example photo.png or report.pdf) — the tool also tells you what type the bytes look like.

Privacy you can verify, not just trust

Most online Base64 tools send what you paste to their server to convert it — fine for "Hello, World!", less fine for an API key, a token, or a file from work. This one can't: the encoding and decoding run entirely in your browser, using your browser's own text and file APIs. Your input is never sent anywhere — the only requests to other sites are the site's own analytics, which count page views — and nothing you type is saved: reload the page and it is gone. Don't take our word for it:

External requests during use: 0
  1. Press F12 to open developer tools, then the Network tab.
  2. Encode or decode anything above. Watch: apart from the site's analytics, no request fires — no uploads, and your text never leaves your device.
  3. Extra credit: disconnect your internet after this page loads — encoding and decoding still work.

How Base64 encoding works — and when you actually need it

Base64 is a way of writing any bytes — text, an image, a PDF, a cryptographic key — using only 64 safe, printable characters: A–Z, a–z, 0–9, + and /, with = as padding. It exists because much of the internet was built for text: email bodies, JSON, HTTP headers, and URLs all assume the data they carry is printable text, and raw binary bytes get mangled or rejected on the way through. Base64 respells the bytes so they survive the trip.

The mechanism is simple. The encoder reads your data three bytes at a time — 24 bits — and re-slices those 24 bits into four groups of six bits. Each six-bit group is a number from 0 to 63, and each number picks one character from the fixed 64-character alphabet. So every three bytes in become exactly four characters out, and the output is always about 33% larger than the input. That size cost is the whole price of the trick: Base64 never compresses anything, and if a tool promises a smaller file, it is doing something else as well.

A worked example

Take the text Hello, World! — 13 bytes in UTF-8. In groups of three: Hel, lo,, Wo, rld, and a final short group !. The first four groups become four characters each; the last group is one byte short of three, so it produces two characters and two = padding characters. The result is SGVsbG8sIFdvcmxkIQ== — 20 characters, and decoding it returns exactly Hello, World!. Try it above: paste the encoded string, switch to Decode, and watch it come back. Unicode works the same way, because the text is turned into UTF-8 bytes first: Hello, 世界 👋 is 18 bytes and encodes to SGVsbG8sIOS4lueVjCDwn5GL, with no padding because 18 is a multiple of 3.

Where Base64 shows up in real work

Data URIs. A small image can be embedded directly in HTML or CSS as data:image/png;base64,iVBORw0… — the part after ;base64, is the file's bytes in Base64. It saves an HTTP request but costs ~33% more bytes, so it only pays off for tiny assets like icons. This tool's File → Base64 panel produces exactly that payload.

Basic authentication. An HTTP Authorization: Basic header is the Base64 of username:password. That is why you will see strings like dXNlcjpwYXNzd29yZA== in API docs — and why it is not security: anyone who sees the header decodes it instantly. It only ever travels over HTTPS.

Email attachments (MIME). Email is a text protocol, so attachments are Base64-encoded and wrapped at 76 characters per line. If you have ever opened a raw .eml file and seen a wall of Base64, that is a file in transit. This decoder ignores line breaks and whitespace, so you can paste a MIME block as-is.

APIs and tokens. JSON cannot carry raw bytes, so APIs pass binary data — images, signatures, encrypted blobs — as Base64 strings. JWTs (JSON Web Tokens) are three Base64url segments joined by dots: header, payload, signature.

Standard Base64 vs URL-safe Base64 (base64url)

VariantAlphabetPaddingWhere you see it
Standard (RFC 4648 §4)A–Z a–z 0–9 + /Required (=)btoa(), most language APIs, MIME email
URL-safe (RFC 4648 §5)A–Z a–z 0–9 - _Usually omittedJWT, OAuth PKCE, URL parameters, file names

The only difference is the last two characters: standard Base64's + and / have special meanings in URLs — + becomes a space in a query string, and / looks like a path separator — so base64url swaps them for - and _ and usually drops the padding. Use the URL-safe toggle above whenever the output goes into a URL, a cookie, or a JWT; decoding here accepts both alphabets, with or without padding, so you never have to convert between them by hand.

Padding rules, in one paragraph

Output length is always a multiple of 4. If the input is a multiple of 3 bytes, there is no padding. One leftover byte gives two = signs; two leftover bytes give one. The padding carries no data — it only marks where the real bytes end — which is why decoders that know the input length can drop it. This tool repairs missing padding automatically when decoding, and it rejects a length that is 1 more than a multiple of 4, because no valid Base64 string can have that length.

Mistakes this tool is built to catch

Treating Base64 as encryption

Base64 hides nothing. A "secret" in Base64 is plain text with extra steps — anyone can decode it. If you need confidentiality, encrypt first, then Base64-encode the ciphertext if a text channel requires it.

Pasting standard Base64 into a URL

+ and / break in URLs and file names. If your encoded string is going into a link, a cookie, or a JWT, switch on the URL-safe toggle before copying.

Forgetting the padding

Strict decoders in Python, Java, and Go reject Base64 with missing =. Keep padding on unless the receiving system (like JWT) explicitly wants it off — this decoder repairs it, but theirs might not.

Using btoa() on emoji or accented text

JavaScript's btoa() only handles one byte per character and throws on anything outside Latin-1. Text must be UTF-8-encoded first — which this tool does — or the emoji in your string will break the encode.

Decoding binary as text

If the Base64 came from an image or a PDF, decoding it to text gives replacement characters, not the file. Use the Base64 → file panel instead: it rebuilds the original bytes and downloads them, and even tells you what file type they look like.

Expecting a smaller file

Base64 always adds ~33%. Encoding a 3 MB photo gives a ~4 MB string. That is the format working as designed — if size matters, compress the file first, then encode it.

Frequently asked questions

Is Base64 encryption? Can I use it to hide a password or secret?

No. Base64 is a reversible encoding, not encryption: anyone who sees the output can decode it in one step, with no key and no password. It only changes how data looks so it can travel through text-only channels. Never put a password, API key, or token in Base64 and treat it as hidden — use real encryption (for example AES-GCM) or a secrets store instead.

Why does my Base64 output end with one or two = signs?

Base64 works on groups of 3 input bytes, which become 4 output characters. When the input length is not a multiple of 3, the last group is short, so the encoder fills the missing output characters with = padding to keep the total length a multiple of 4. One leftover byte produces two = signs, two leftover bytes produce one. The padding carries no data — it only tells the decoder where the real bytes end — and many systems (including JWT) drop it entirely.

What is the difference between Base64 and URL-safe Base64 (base64url)?

Standard Base64 (RFC 4648 section 4) uses the characters + and /, which have special meanings in URLs and file names — + becomes a space in a query string and / looks like a path separator. URL-safe Base64, or base64url (RFC 4648 section 5), replaces + with - and / with _, and usually drops the = padding. It is the variant used by JSON Web Tokens (JWT), OAuth PKCE code challenges, and URL parameters. Decoding accepts both alphabets here, so you can paste either form.

Why does decoding fail on emoji, or show garbled text?

Base64 encodes bytes, not letters, so text must first be turned into bytes — almost always UTF-8. An emoji like 👋 is 4 bytes in UTF-8, and an old shortcut such as JavaScript's btoa() only handles one byte per character, so it throws on anything outside Latin-1. This tool converts text to UTF-8 bytes first, so emoji, Chinese, Arabic, and every other script round-trip correctly. Garbled output after decoding usually means the original text was encoded with a different character set (for example Windows-1252) instead of UTF-8.

Is it safe to paste sensitive text or a file into this encoder?

Yes for this page: the encoding and decoding run entirely in your browser, and your input is never sent anywhere — the only requests to other sites are the site's own analytics, which count page views. You can verify that in your browser's Network tab while you use the tool, and the live counter in the privacy section below shows it. That said, remember Base64 itself hides nothing: the output is as readable as the input to anyone who sees it, so do not share encoded secrets publicly.