Tech & Digital
Base64 Encoder & Decoder (UTF-8, URL-safe)
Convert text to Base64 and back in your browser. Choose a direction, paste your text or Base64 string, and the calculator returns the result, the URL-safe variant, and the size in bytes. Accented letters, Arabic, Chinese and emoji are handled correctly because the text is converted to UTF-8 bytes first, as the web standard requires.
How to use this calculator
- Choose Encode to turn text into Base64, or Decode to turn Base64 back into text.
- Paste or type your input; line breaks and spaces in Base64 are ignored when decoding.
- Read the result; when encoding you also get the URL-safe version.
- Check the byte count to see how much space the data takes.
- Copy the result into your code, email header, data URL or configuration file.
What Base64 is for
Many systems were designed to carry text, not arbitrary bytes. Email, for example, was built for 7-bit characters, and JSON, XML, URLs and HTTP headers all have characters with special meanings. Base64 solves this by representing any sequence of bytes using only 64 safe characters, so images can be embedded in web pages as data URLs, attachments can travel inside email (MIME), and binary keys or certificates can be pasted into configuration files.
The encoding is defined in RFC 4648, the Internet standard that also describes Base32 and Base16. It is not compression and not encryption: the output is about one third larger than the input, and anyone can decode it. Never use Base64 to hide passwords or personal data.
Text, bytes and UTF-8
Base64 works on bytes, so text must first be turned into bytes. Numerra uses UTF-8, the encoding used by almost all web pages, which stores English letters in 1 byte, most accented and Arabic or Cyrillic letters in 2 bytes, Chinese and Japanese characters in 3 bytes, and emoji in 4 bytes. That is why the same number of characters can give very different Base64 lengths. When decoding, the calculator checks that the bytes form valid UTF-8; if they do not, the Base64 probably holds binary data such as an image or a compressed file rather than text.
Standard and URL-safe Base64
The + and / characters of standard Base64 have special meanings in URLs and file names, and = is used in query strings. The base64url alphabet replaces them with - and _, and padding is often omitted because the length can be inferred. It is used in JSON Web Tokens (JWT), in many web APIs and in file names. The decoder here accepts both alphabets and ignores spaces and line breaks, so you can paste Base64 copied from emails or PEM files that wrap lines every 64 or 76 characters. Everything runs in your browser; nothing you type is sent to a server.
Formula & method
Every 3 bytes (24 bits) become 4 characters of 6 bits from the 64-character alphabet A–Z a–z 0–9 + /Padding "=" fills the last group when the input is not a multiple of 3 bytesURL-safe Base64 (base64url) uses - and _ instead of + and / and drops the padding (RFC 4648 §5)Base64 takes the input 3 bytes (24 bits) at a time and writes them as 4 characters, each carrying 6 bits, from the alphabet A–Z, a–z, 0–9, + and /. When the input does not divide evenly into 3 bytes, one or two = signs pad the last group. The URL-safe alphabet of RFC 4648 section 5 replaces + with - and / with _, and usually drops the padding.
Worked example
Encoding "Hello, World!"
- The text is 13 bytes in UTF-8: 48 65 6c 6c 6f 2c 20 57 6f 72 6c 64 21
- Four full groups of 3 bytes give 16 characters; the last single byte gives 2 characters plus ==
- "héllo" is 6 bytes because é takes 2 bytes in UTF-8, and encodes as aMOpbGxv
Answer: "Hello, World!" becomes SGVsbG8sIFdvcmxkIQ== (20 characters).
Frequently asked questions
Is Base64 a form of encryption?
No. It is an encoding that anyone can reverse instantly. Use real encryption to protect secrets.
Why does Base64 end with = or ==?
The equals signs are padding: one = when the last group has 2 bytes, two when it has 1 byte.
How much bigger is Base64 than the original?
About 33%: every 3 bytes become 4 characters, plus up to 2 padding characters.
What is base64url?
The URL- and filename-safe variant from RFC 4648 that uses - and _ instead of + and /, usually without padding. JWTs use it.
Why does my decoded result say it is not valid text?
The Base64 probably encodes binary data such as an image or a zip file, which cannot be shown as text.
Is my text sent to a server?
No. Encoding and decoding happen entirely in your browser.