Skip to main content
CalcChef

Base64 Converter

Encode text to Base64 or decode Base64 to text. UTF-8, standard and URL-safe alphabets, optional padding on decode, up to 250,000 characters. How it works

Use the Base64 Converter

Result

About the Base64 Converter

Hello in Base64 is SGVsbG8=. The converter turns text into UTF-8 bytes, writes every 3 bytes as 4 characters and pads the end with = when the last group is short. Decoding reverses it and accepts both the standard and the URL-safe alphabet. It handles text only, so use Base64 File to String for a file.

Text, its UTF-8 size and its Base64 form

TextUTF-8 bytesStandard Base64URL-safe Base64
a1YQ==YQ
ab2YWI=YWI
abc3YWJjYWJj
Hello5SGVsbG8=SGVsbG8
Hello, World!13SGVsbG8sIFdvcmxkIQ==SGVsbG8sIFdvcmxkIQ
user:pass9dXNlcjpwYXNzdXNlcjpwYXNz
é2w6k=w6k
日本65pel5pys5pel5pys
hello?>>8aGVsbG8/Pj4=aGVsbG8_Pj4

Each row is what the converter returns, with and without the URL-safe option. The URL-safe form swaps + and / for - and _ and drops the = padding (RFC 4648, section 5). A multiple of 3 bytes needs no padding.

How to use this tool

  1. Choose Encode to turn text into Base64, or Decode to turn Base64 into text.
  2. Type or paste the input. The result appears as you type.
  3. In Encode mode, switch on URL-safe output for - and _ with no padding.
  4. Press Copy to copy the result.

Frequently asked questions

How do I decode a Base64 string to text?
Choose Decode and paste the string. SGVsbG8= and SGVsbG8 both decode to Hello, because padding is optional, and spaces or line breaks in the pasted text are ignored. A string in the URL-safe alphabet decodes too: aGVsbG8_Pj4 gives hello?>>.
Why does decoding say the Base64 is binary data, not UTF-8 text?
The string is valid Base64, but the bytes it holds are not UTF-8 text. /w== is the single byte 0xFF, which UTF-8 never uses, so the page reports binary data instead of an invalid string. Use Base64 File to String to decode it to a file.
What is URL-safe Base64?
It is the same encoding with - and _ in place of + and /, usually without the = padding, so the text can sit in a URL or a file name (RFC 4648, section 5). hello?>> is aGVsbG8/Pj4= in the standard form and aGVsbG8_Pj4 in the URL-safe form. A string that mixes + or / with - or _ is rejected as invalid.
Why does Base64 end with = or ==?
Base64 reads 3 bytes at a time and writes 4 characters. When the input is 1 byte over a multiple of 3, two = pad the end (a gives YQ==), and when it is 2 bytes over, one = does (ab gives YWI=). A multiple of 3 bytes, such as abc giving YWJj, needs none.
Is Base64 encryption?
No. It is a reversible encoding that anyone can decode, as dXNlcjpwYXNz decoding to user:pass shows. Do not use it to hide a password or a key.
Is there a size limit, and is my text uploaded?
Input is limited to 250,000 characters, and a longer paste shows a message instead of a result. The conversion runs in your browser and the text is not uploaded.

Related Tools

View all tools