Base64 Encoder & Decoder - Convert Text and Files Online

Encode text or files to Base64 and decode Base64 back to readable text, entirely in your browser.

Paste text and click Encode, or paste a Base64 string and click Decode. Tick the URL-safe option for tokens and query strings, or pick a file to get a ready-to-use data URI.

Base64 Encoder & Decoder - Convert Text and Files Online
Encode text or files to Base64 and decode Base64 back to readable text, entirely in your browser.

The file is read locally and converted to a Base64 data URI in the output box. Nothing is uploaded.

How it works: text is converted to UTF-8 bytes, then every 3 bytes are mapped to 4 characters from the 64-character alphabet A-Z a-z 0-9 + / (with = padding). URL-safe mode swaps + and / for - and _ and drops the padding.

About the Base64 encoder and decoder

Base64 is a binary-to-text encoding that represents arbitrary bytes using only 64 printable characters: the uppercase and lowercase Latin letters, the digits 0-9, and the symbols + and /. It exists because many protocols and formats — email bodies, JSON documents, XML files, HTTP headers, CSS and HTML attributes — were designed to carry plain text and can corrupt or reject raw binary data. Encoding the bytes as Base64 lets you embed an image in a stylesheet, store a small binary blob in a JSON field, build a basic-auth header, or move data through systems that only understand text. This Base64 encoder and decoder runs entirely in your browser with JavaScript. Nothing you type or any file you pick is uploaded to a server, which makes it safe to work with API keys, tokens, certificates, and other sensitive material. The tool is Unicode-correct: text is first converted to UTF-8 bytes and only then encoded, so accented letters, symbols, emoji, and CJK characters round-trip cleanly instead of being mangled the way naive single-byte implementations mangle them. The encoder groups the input bytes three at a time and maps each 24-bit group to four characters from the Base64 alphabet. When the input length is not a multiple of three, the output is padded with one or two = signs. The decoder reverses the process and tolerates both padded and unpadded input, as well as whitespace and line breaks, so you can paste wrapped output from MIME email or PEM certificate blocks directly. The URL-safe option produces the RFC 4648 base64url variant: + becomes -, / becomes _, and the trailing = padding is removed. This is the form used in JWT tokens, URL query parameters, and file names, where + and / would either be misinterpreted or require further percent-encoding. The decoder accepts either alphabet automatically, so you never have to tell it which variant you are pasting. The file mode converts any local file — an image, a font, a PDF — into a data URI that you can paste straight into an src attribute or a CSS url() value. Keep in mind that Base64 output is roughly 33% larger than the original bytes, so it suits small assets and payloads better than large downloads. Also remember that Base64 is an encoding, not encryption: anyone can decode it, so never rely on it to hide secrets.

Base64 encoding examples

A few conversions that show how the alphabet, padding, and the URL-safe variant behave.

InputOutputNote
ManTWFuThree ASCII bytes map exactly to four Base64 characters with no padding needed.
light work.bGlnaHQgd29yay4=Eleven bytes leave a two-byte remainder, so one = padding character is appended.
éw6k=The letter é becomes the two UTF-8 bytes C3 A9 before encoding — proof the tool is Unicode-safe.
??? (URL-safe mode)Pz8_Standard Base64 gives Pz8/ — the URL-safe variant swaps / for _ so the value can live in a URL or file name.

How to encode or decode Base64

  1. Paste your text (to encode) or your Base64 string (to decode) into the Input box.
  2. Optionally tick URL-safe if you need the base64url variant used by JWTs and query strings.
  3. Click Encode or Decode — the converted result appears instantly in the Output box.
  4. To convert a file, choose it with the file picker and copy the resulting data URI from the output.
  5. Click Clear to reset both boxes and start over.

Base64 encoder & decoder FAQ

Is Base64 a form of encryption?
No. Base64 is a reversible encoding, not encryption — anyone can decode it without a key. Use it to make binary data text-safe, never to protect secrets. If you need confidentiality, encrypt the data first and Base64-encode the ciphertext if a text form is required.
What is the difference between Base64 and base64url (URL-safe)?
Standard Base64 uses + and /, which clash with URL and file-name syntax. The URL-safe variant defined in RFC 4648 replaces + with -, / with _, and usually omits the = padding. JWT tokens and many web APIs use base64url; this tool encodes either variant and decodes both automatically.
Why is my decoded output garbled?
Most often the original data was not UTF-8 text — for example it was a binary file, or text encoded with a legacy charset like Latin-1. Decoding is byte-exact; the garbling appears when those bytes are interpreted as UTF-8 text. Truncated or corrupted input strings are the other common cause.
Why do some Base64 strings end with one or two = signs?
Base64 works on 3-byte groups that become 4 output characters. If the input length is not a multiple of three, = characters pad the final group: one = for a two-byte remainder, two for a single byte. Decoders use the padding to know how many real bytes the last group holds.
How much bigger does Base64 make my data?
Every 3 bytes become 4 characters, so encoded output is about 33% larger than the original, plus up to two padding characters. A 30 KB image becomes roughly 40 KB as a data URI, which is why inlining is best reserved for small assets.
Are my text and files uploaded anywhere?
No. All encoding and decoding happens locally in your browser using the standard TextEncoder, TextDecoder, and btoa/atob APIs. Files are read with the FileReader API on your machine and never leave it, so the tool is safe for tokens, keys, and private documents.