Skip to content
Cheeky Tools

Base64 Encode and Decode

Text & Dev ToolsText to Base64 and back, as UTF-8, with the URL-safe alphabet — errors explained, nothing uploaded.

What you type never leaves this device. Everything here runs in your browser — your text is never uploaded, stored or seen by us. Open your network tab and check.

Base64

SGVsbG8sIOS4lueVjCDwn5GL

18 bytes of UTF-8 became 24 characters — about four for every three bytes.

How this is calculated

Encode   text → UTF-8 bytes → groups of 3 bytes → 4 characters
         from A–Z a–z 0–9 + /   (URL-safe: - _ instead of + /)
         = pads the last group when it is 1 or 2 bytes short
Size     4 × ceil(bytes ÷ 3) characters with padding
Decode   the same in reverse; spaces and line breaks are ignored

How it works

Base64 turns any bytes into text made only of letters, digits and two symbols, so binary data can travel through systems built for text: email attachments, data URLs in web pages, JSON fields, the three parts of a JSON Web Token. It is an encoding, not encryption. Anyone can decode it, so it hides nothing.

It works on bytes, three at a time. Those 24 bits are split into four groups of six, and each group picks one of 64 characters. That is why Base64 is always about a third larger than what it encodes, and why = signs appear at the end: they pad a last group that had only one or two bytes to fill it.

Text has to become bytes first, and this is where many tools go wrong. The browser's own btoa function encodes é as a single Latin-1 byte and refuses characters such as € or emoji outright. Every other system — servers, databases, other languages — means the UTF-8 bytes of the text. This tool encodes UTF-8, so "café" becomes Y2Fmw6k=, the same answer Python, Node or a server would give, where btoa gives Y2Fm6Q==.

Standard Base64 uses + and /, which have special meanings in URLs and file paths. The URL-safe alphabet, defined in the same standard, uses - and _ instead, and usually drops the padding; JSON Web Tokens use it. Decoding accepts either alphabet, with or without padding, and ignores the line breaks email systems insert. If the decoded bytes are not text — an image, say — the first bytes are shown in hexadecimal rather than as a screen of garbled characters.

Worked example

Encoding "Hello, 世界 👋"

  1. Characters 11: Hello, a space, 世界, a space and 👋
  2. UTF-8 bytes 18 — the two Chinese characters take 3 each,
  3. the emoji takes 4
  4. Groups 18 ÷ 3 = 6 groups of 3 bytes
  5. Base64 6 × 4 = 24 characters, no padding needed
  6. SGVsbG8sIOS4lueVjCDwn5GL

18 bytes become 24 characters — a third larger, as Base64 always is

How to use it

  1. Choose Text → Base64 to encode, or Base64 → text to decode.
  2. Type or paste into the box. The result updates as you go.
  3. When encoding, tick URL-safe for anything going into a URL, a file name or a token, and untick padding if the destination does not want it.
  4. Copy the result, or use it as the input to reverse the direction and check it round-trips.

What this tool does not do

  • Base64 is not encryption or hashing. It hides nothing from anyone who has the text.
  • Text only in this tool: it encodes typed or pasted text, not files. Decoded binary is shown as a hexadecimal preview, not offered as a download.
  • Text is always encoded as UTF-8. Systems that expect another encoding, such as UTF-16, will read the result differently.
  • Base64 is about 33% larger than the data it encodes, plus line breaks if a system wraps it.
  • Very large inputs, in the tens of megabytes, can make the page slow because the whole text is encoded on every change.

Frequently asked questions

Is Base64 encryption?

No. It is a way of writing bytes as text, with no key and no secret: anyone can decode it instantly, including with this page. It is used to carry data safely through text-only systems, not to protect it. For secrecy you need encryption.

Why does my Base64 differ from another tool's?

Almost always because of how the text became bytes. This tool uses UTF-8, which is what servers, databases and programming languages use. Tools built on the browser's btoa function treat accented letters as single Latin-1 bytes, so "café" comes out as Y2Fm6Q== there and Y2Fmw6k= here — and btoa fails outright on characters such as € and emoji.

What are the = signs at the end?

Padding. Base64 encodes bytes three at a time into four characters. When the data does not divide into threes, the last group is filled with one or two = signs so the length stays a multiple of four. Some systems, including JSON Web Tokens, leave the padding off; decoding here works either way.

What is URL-safe Base64?

The same encoding with two characters swapped: - instead of + and _ instead of /, because + and / mean something in URLs and file paths. It is defined in the same standard, RFC 4648, and is what JSON Web Tokens use.

How much bigger does Base64 make data?

About a third. Every three bytes become four characters, so 18 bytes become 24 characters, and a 3 MB image becomes about 4 MB of text. That is why images embedded as data URLs make pages heavier.

Is what I paste sent anywhere?

No. Encoding and decoding run in your browser and no network request carries your text. That matters because Base64 often holds things like tokens and credentials. The only requests the page makes once you use it are small ones recording that the tool was used.

Related tools

Spotted something wrong?
tell us

The figure you got and the figure you expected, if you have both. A source helps.

Only so we can reply. Leave it blank and we still read it.

— every formula on this page is published so it can be checked.

Last updated 13 September 2026.