Base64 Encode and Decode

Encode text to Base64 or decode it back. UTF-8 safe, with a URL-safe option. Nothing is uploaded.

Text to Base64

Any text, in any language. Up to 1 million characters.

Base64

SGVsbG8sIEl2b3J5IQ==

Encoded from 13 characters of text.

Input
13 bytes
Output
20 characters
SGVsbG8sIEl2b3J5IQ==

Base64 makes the data about one third larger.

Base64 to text

Standard or URL-safe, with or without = at the end. Spaces and line breaks are ignored.

Decoded text

Hello, Ivory!

Decoded as UTF-8 text.

Output
13 characters
Hello, Ivory!

The Base64 decodes to 13 characters of text.

Add this calculator to your website

Free to use on any site or blog. Paste this code where you want the calculator to appear. It stays up to date, needs no account, and keeps your visitors' numbers in their own browser.

Preview

How it works

Base64 writes any data using only 64 safe characters: A-Z, a-z, 0-9, + and /. It takes the bytes in groups of 3 and turns each group into 4 characters, which is why the result is about one third larger. If the last group is short, = signs fill it out.

This tool first turns your text into UTF-8 bytes, so letters outside English, such as Urdu or é, and emoji, encode and decode correctly. The URL-safe form swaps + and / for - and _ so the result can sit in a web address or a file name.

It all runs in your browser. Nothing is sent to a server.

Check it by hand: Base64 turns every 3 bytes into 4 characters. The first 3 bytes of "Hello, Ivory!" are H, e, l = 72, 101, 108. In binary that is 01001000 01100101 01101100, which regroups as 010010 000110 010101 101100 = 18, 6, 21, 44. Those index S, G, V, s in the Base64 table, so "Hel" is "SGVs". 13 bytes make 5 groups, so the output is 5 × 4 = 20 characters.

Worked example

The text "Hello, Ivory!" is 13 bytes. Encoded, it becomes SGVsbG8sIEl2b3J5IQ== (20 characters). Decoding that string gives back the same text.

Good to know

  • Base64 is not encryption. Anyone can decode it, so never use it to hide a password or secret.
  • This tool decodes to text. If the Base64 holds a file such as an image, the result will not be readable text and the tool will say so.
  • The input must be valid Base64. A stray character or a wrong length is reported as an error.

Questions people ask

How do I decode a Base64 string?

Open the "Base64 to text" panel, paste the string and read the result. Spaces and line breaks are ignored, and missing = signs are fine.

What is Base64 used for?

It lets binary data travel through systems that only handle text, such as email, JSON and web addresses. It is also used to embed small images in web pages.

Is Base64 secure?

No. It is only a way of writing data, not a lock. Anyone can reverse it in a second.

What is URL-safe Base64?

The same encoding with - and _ in place of + and /, and often without the = at the end, so it works inside links and file names.

Does it work with Urdu and emoji?

Yes. The text is converted to UTF-8 first, so any language and emoji encode and decode correctly.

Why does Base64 output end with = signs?

Base64 works in groups of 3 bytes. If the data does not fill the last group, = signs pad it. 13 bytes leave 1 byte over, so the output ends with two = signs.

Part of the guide: Developer and design tools: QR codes, passwords, JSON, colors and timestamps

Formulas and text last checked on 14 October 2026. Everything is calculated in your browser, so nothing you enter is sent or stored. Spotted a mistake? Tell us and we will fix it.