Base64 Encoder / Decoder

Quick answer: Choose Encode, type text, and get its Base64 β€” for example, β€œHello, CalcNest!” becomes SGVsbG8sIENhbGNOZXN0IQ== (24 characters). Choose Decode, paste Base64, and get the text back. Tick the URL-safe box to swap + and / for - and _. Everything runs locally in your browser β€” nothing is sent anywhere.

This free Base64 encoder and decoder converts text to Base64 and Base64 back to text instantly. It is UTF-8 safe (emoji and non-Latin scripts work), supports the URL-safe alphabet variant, and updates live as you type.

Enter your text

Output


        

How to use this tool

Pick Encode and type or paste plain text to get its Base64, or pick Decode and paste Base64 to recover the text. The output updates live. Tick the URL-safe box when the result will live inside a URL or filename, then use Copy output to grab it. Decoding shows an error message instead of crashing when the input is not valid Base64.

How this is calculated

Method: encoding converts the text to UTF-8 bytes (TextEncoder), then maps each group of 3 bytes to 4 alphabet characters with = padding for the final partial group. Decoding reverses the process (atob on the byte string, then TextDecoder). The URL-safe variant replaces + with - and / with _ per RFC 4648 Β§5; decoding accepts either alphabet.

Input definitions: β€œText to encode” is any UTF-8 text; β€œBase64 to decode” is text using the 64-character alphabet plus optional = padding. Assumptions: output keeps = padding in URL-safe mode; whitespace inside pasted Base64 is ignored when decoding.

Worked example

Encoding β€œHello, CalcNest!” produces SGVsbG8sIENhbGNOZXN0IQ== β€” 24 characters, ending in one = pad because 16 input bytes leave one byte in the final group. Decoding SGVsbG8sIENhbGNOZXN0IQ== returns β€œHello, CalcNest!” exactly.

Reference data

The Base64 alphabet (RFC 4648, 2006)
CharactersValuesURL-safe
A–Z0–25same
a–z26–51same
0–952–61same
+ /62 / 63- / _
=padding (not a value)

Source: RFC 4648 (2006) β€” The Base16, Base32, and Base64 Data Encodings.

Method & sources

The tool implements the standard Base64 scheme: 3 input bytes become 4 output characters drawn from the 64-character alphabet, with = padding marking unused positions in the last block. The URL-safe variant follows RFC 4648 Β§5. All processing is local JavaScript; no network calls are made.

  • RFC 4648 (2006) β€” The Base16, Base32, and Base64 Data Encodings

No estimates appear on this page; every result is computed live from your input.

Frequently asked questions

Is Base64 encryption?

No β€” Base64 is an encoding, not encryption. Anyone can decode Base64 instantly, so it provides zero secrecy. Its job is to represent binary data as plain text that survives copy-paste, JSON, URLs, and email.

What do the = signs at the end mean?

They are padding. Base64 works in groups of 3 bytes; if the input length is not a multiple of 3, one or two = characters mark the unused positions in the final 4-character block so the decoder knows where the data ends.

When should I use the URL-safe variant?

Use it whenever the encoded output goes into a URL, a filename, or a query parameter. The standard alphabet contains + and /, which have special meanings in URLs; the URL-safe variant replaces them with - and _, which need no percent-encoding.

Related calculators