Text & Developer tool

Base64 Encode and Decode Online

Encode text to Base64 or decode a Base64 string, in one click.

  • Instant results
  • Working shown
  • No sign-up
  • Runs in your browser
ToolUpdates as you type

17 bytes in, 24 Base64 characters out.

Text is converted as UTF-8, so Hindi, Telugu and emoji work. Everything runs in your browser.

How it works

This Base64 converter turns text into Base64 and decodes Base64 back into text as you type. Choose Encode or Decode, paste your input and copy the result. Text is handled as UTF-8, so Indian languages and emoji work, and a URL-safe option uses - and _ instead of + and /.

This Base64 encode and decode online tool converts text to Base64 and back. Choose Encode to turn text into Base64, or Decode to turn a Base64 string back into readable text. The result updates as you type.

How to use the Base64 converter

  1. Choose Encode text to Base64 or Decode Base64 to text.
  2. Type or paste your input in the top box.
  3. Read the result in the second box. If a Base64 string is broken, the error tells you why.
  4. Click Copy result. Click Swap to send the result back as input in the other direction.

Tick URL-safe when encoding if the result will go into a web address or a token.

What Base64 is and why it is used

Base64 is a way to write any data using only 64 safe characters: A-Z, a-z, 0-9, + and /, with = for padding. Some systems, such as email and parts of web pages, were built to carry plain text only. Base64 lets them carry other data, such as images or binary files, without damaging it.

You will see Base64 in:

  • Data URLs in HTML and CSS, such as data:image/png;base64,iVBOR...
  • Email attachments, which are sent as Base64 text
  • JWT tokens used for login on websites, which are three URL-safe Base64 parts joined by dots
  • HTTP Basic authentication, where username:password is sent as Base64 (which is why it must only be used over HTTPS)

How Base64 encoding works

Base64 takes 3 bytes (24 bits) at a time and splits them into four 6-bit groups. Each 6-bit number from 0 to 63 maps to one character.

Take the text "Man":

Step Value
Letters M, a, n
ASCII codes 77, 97, 110
Bits 01001101 01100001 01101110
Split into 6-bit groups 010011 010110 000101 101110
Decimal 19, 22, 5, 46
Base64 characters T, W, F, u

So "Man" becomes TWFu. You can check the bits with the text to binary converter.

Text Base64
M TQ==
Ma TWE=
Man TWFu
Hello SGVsbG8=
hello world aGVsbG8gd29ybGQ=

The output is always about a third longer than the input: 3 bytes in, 4 characters out.

Common mistake: A common mistake is treating Base64 as a way to protect data. Decoding SGVsbG8= gives "Hello" in one click, with no key. Use real encryption, or better, do not store secrets in the browser at all.

Text in Hindi, Telugu and other languages

Base64 works on bytes, not letters. This tool first turns your text into UTF-8 bytes, so every language works. "नमस्ते" is 6 characters on screen but 18 bytes in UTF-8, and it encodes to 4KSo4KSu4KS44KWN4KSk4KWH. Some older tools only handle English letters and fail on such text.

Base64 in code

Language Encode Decode
JavaScript (browser) btoa("Hello") atob("SGVsbG8=")
Python base64.b64encode(b"Hello") base64.b64decode("SGVsbG8=")
Java Base64.getEncoder().encodeToString("Hello".getBytes()) new String(Base64.getDecoder().decode("SGVsbG8="))

In JavaScript, btoa accepts only characters with codes up to 255, so convert other text to UTF-8 bytes first, as this tool does.

Pro tip: Need to put text inside a URL rather than a token? Percent-encoding is usually the right choice there. Use the URL encoder and decoder.

Frequently asked questions

Is Base64 encryption?
No. Base64 is an encoding, not encryption. Anyone can decode it without a key, so never use it to hide passwords or secrets.
Why does Base64 end with = or ==?
Base64 turns every 3 bytes into 4 characters. When the input length is not a multiple of 3, = signs pad the end: one = when 2 bytes are left over, two when 1 byte is left over.
Why does my Base64 string fail to decode?
Common causes are a character that is not part of Base64, such as a space in the middle or a $ sign, or a string that was cut short. The tool shows which character is the problem. Line breaks and spaces at the ends are ignored.
What is URL-safe Base64?
Standard Base64 uses + and /, which have special meanings in URLs. URL-safe Base64 uses - and _ instead and usually drops the = padding. It is used in JWT tokens and web links. This decoder accepts both forms.
Can I decode an image or file here?
This tool decodes Base64 into text. If the data is an image or another file, it tells you that the bytes are not readable text instead of showing garbled characters.

Try another tool

See all free tools
Chat with us