Skip to content
Kilnfile

Base64 Encode and Decode

Encode text to Base64 or decode Base64 back to text, with full UTF-8 support.

Processed on your device, nothing uploadedLast updated

To encode text as Base64, paste it into the Input box, set Direction to Encode text to Base64 and click Convert; to decode, choose Decode Base64 to text. Text is treated as UTF-8, so accented letters and emoji survive the round trip, and the URL-safe option swaps + and / for - and _. Everything runs in your browser.

Your file stays in this tab.On your device
Options

How do I encode or decode Base64?

  1. Paste the text you want to encode, or the Base64 string you want to decode, into the Input box.
  2. Set Direction to Encode text to Base64 or Decode Base64 to text.
  3. Tick URL-safe alphabet (- and _) if the result is going into a URL, a filename or a JWT.
  4. Click Convert; the output panel shows the result and updates as you edit.
  5. Click Copy output to copy the encoded or decoded text.

Base64 represents binary data using 64 printable characters (A to Z, a to z, 0 to 9, + and /) so it can travel safely through systems built for plain text: email attachments, JSON fields, HTTP basic authentication headers, data: URLs in CSS and HTML, and cookies. Every 3 bytes of input become 4 characters of output, so encoded text is about 33% larger than the source, and padding with one or two = signs rounds off the final group.

Text is encoded as UTF-8 before conversion, which is what the tool adds over the browser's raw btoa() function. btoa() throws an error on anything outside Latin-1, so a pound sign works but an emoji or a Chinese character does not. Here, "£10 café" with an emoji on the end encodes and decodes back exactly. Decoding is tolerant: missing = padding, surrounding whitespace and line breaks from an email or a certificate file are all accepted.

URL-safe alphabet (- and _) replaces + with - and / with _, following RFC 4648 section 5. Standard Base64 breaks inside a URL because + is read as a space and / as a path separator, so anything going into a query string, a filename or a JSON Web Token uses the URL-safe form. Decoding accepts either alphabet, so you can paste a JWT segment straight in. Note that Base64 is an encoding, not encryption: anyone can decode it, so never use it to hide passwords or personal data.

Everything runs as plain JavaScript in your browser tab; the text is never transmitted or stored, which matters when you are decoding tokens, credentials or configuration secrets. Strings of several megabytes convert almost instantly. For encoding files rather than text, use the Image to Base64 tool, which produces a ready-made data: URL.

How it works: this tool uses plain JavaScript running in your browser tab. No server is involved, so Kilnfile never sees your file. Last reviewed 20 September 2026.

Frequently asked questions

Is Base64 the same as encryption?

No. Base64 is a reversible encoding that anyone can decode in a second, including with this tool. It exists to move binary or non-ASCII data through text-only systems, not to protect it. Use proper encryption for anything sensitive.

Why does my decoded text show strange characters?

Either the original was not UTF-8 text (for example a binary file or a Windows-1252 document) or the string is not actually Base64. Check that the input contains only A to Z, a to z, 0 to 9, +, /, -, _ and = and that you copied the whole string.

What does the URL-safe option do?

It swaps the two characters that cause trouble in URLs: + becomes - and / becomes _. This variant is what JWTs, OAuth state values and many APIs expect. Decoding accepts both the standard and URL-safe forms automatically.

Why is the Base64 output longer than my text?

Every 3 bytes of input become 4 output characters, so Base64 is about a third larger, plus up to two = characters of padding. Non-ASCII characters take 2 to 4 bytes each in UTF-8 before encoding, so emoji-heavy text grows more.

Is the text I paste kept anywhere?

No. Encoding and decoding happen inside your browser tab as JavaScript and nothing is sent to a server or saved. That makes it safe to decode tokens and credentials, though you should still avoid pasting secrets on a shared computer.

Cite this page: “Base64 Encode and Decode: Text, Unicode and URL-Safe”, Kilnfile, https://kilnfile.com/text/base64-encode-decode/

Guides