Free Online Tool

Base64 Encoder & Decoder

Encode text into Base64 or decode Base64 back into readable text. Everything happens in your browser — your text never leaves your device.

Base64 is an encoding, not encryption — anyone can decode it. Never use it to hide passwords or secrets.

Rate This Tool

★★★★★

How useful was this tool? Click a star to rate it.

Loading ratings…

Advertisement

How to Use

1. Type or paste your text in the box. 2. Click Encode to Base64 to convert it, or paste Base64 and click Decode from Base64 to turn it back into text. 3. Copy the result.

About This Base64 Encoder & Decoder

Base64 is a way to turn any text into a safe string of letters, numbers and a few symbols, so it can be sent through systems that only accept plain text. For example, email attachments, website images and API tokens are often sent as Base64. This free Base64 encoder and decoder works in both directions: type normal text and get Base64, or paste Base64 and get the original text back. Everything happens in your browser, so your text never leaves your device.

Base64 works by taking 3 bytes of data at a time and turning them into 4 characters from a 64-character alphabet: A-Z, a-z, 0-9, plus (+) and slash (/), with equals (=) used as padding at the end. That is why Base64 text is about one third longer than the original. It is important to know that Base64 is not encryption: anyone can decode it in seconds, so it must never be used to hide passwords or secrets.

Base64 Worked Example

Take the word "Hello". Encode it in the tool above and you get "SGVsbG8=". The 5 letters of "Hello" become 8 Base64 characters, with one equals sign as padding. Now decode "SGVsbG8=" and you get "Hello" back. Try a longer sentence: "AI Tricks Tools" encodes to "QUkgVHJpY2tzIFRvb2xz". Notice that the encoded text only uses letters, numbers and the equals sign, which is why it is safe to send in a web address or an email header.

Second Worked Example: Decoding a Token

Suppose you receive the Base64 string "SGVsbG8sIFdvcmxkIQ==". Paste it into the box above and click Decode from Base64, and you get "Hello, World!". The two equals signs at the end are padding, which Base64 adds when the input length is not a multiple of 3. Now try to decode something that is not valid Base64, such as "Hello!!!" — the tool shows an "Invalid Base64" message, because the exclamation marks are not part of the Base64 alphabet. Valid Base64 only uses A-Z, a-z, 0-9, +, / and = at the end.

How Base64 Encoding Works

Base64 takes the input as bytes, groups them in threes, and splits each group of 24 bits into four groups of 6 bits. Each 6-bit group (a number from 0 to 63) becomes one character from the 64-character alphabet. If the input is not a multiple of 3 bytes, the last group is padded with zeros and equals signs are added at the end: one = if one byte is missing, two = if two bytes are missing. For example, "Hi" is 2 bytes, so it encodes to 3 characters plus one = sign: "SGk=". Decoding reverses the process exactly, so the original text comes back unchanged.

Tips for Using the Base64 Encoder & Decoder

Remember it is not encryption. Anyone can decode Base64, so never use it for passwords, secrets or private data. Check for padding. A valid Base64 string often ends with one or two = signs; if they are missing, decoding may fail. Use it for tokens and data URLs. Base64 is perfect for API keys, small images in web pages and data that must travel as plain text. Copy the full string. Missing even one character breaks the decoding, so copy the whole result. Test the round trip. Encode, then decode the result, and check that you get the original text back.

Step-by-Step Guide: How to Use the Base64 Encoder & Decoder

  1. Type or paste your text into the box above.
  2. Click Encode to Base64 to convert it, or paste a Base64 string and click Decode from Base64.
  3. Read the result in the box below. If the Base64 is invalid, you will see a clear error message.
  4. Click Copy Result to copy the output and paste it where you need it.
  5. Test the round trip: decode what you encoded, and check that the original text comes back.

Common Mistakes to Avoid

Thinking Base64 is encryption. It is only an encoding — anyone can decode it, so it gives no security at all. Losing the padding. The = signs at the end matter; removing them can break the decoding. Adding extra spaces or line breaks. Spaces and new lines are not part of Base64 and can make decoding fail. Encoding the wrong thing. Make sure you encode the text itself, not a file name or a link to the text. Forgetting non-English characters. This tool handles Urdu, Arabic and other scripts correctly by using UTF-8, but some older tools do not, so test with a sample first.

Pro Tip: If you see a long string of letters and numbers ending in = in a web address or an email, it is probably Base64. Paste it here to see what it says.

Note: Base64 is an encoding, not encryption. Never use it to protect passwords, credit card numbers or other secrets — use real encryption for that.

Frequently Asked Questions

What is Base64? Base64 is a way to represent any data as a string of letters, numbers, + and /, so it can be sent safely through systems that only accept plain text, such as email and web addresses.

Is Base64 encryption? No. Base64 is only an encoding — anyone can decode it in seconds. It gives no security at all, so never use it to hide passwords or secrets.

Why is Base64 longer than the original text? Base64 turns every 3 bytes into 4 characters, so the result is about one third longer than the original. Padding with = signs can add a little more.

What are the = signs at the end of Base64? They are padding. Base64 works in groups of 3 bytes, so if the input is not a multiple of 3, = signs are added to fill the last group.

Can Base64 handle Urdu or Arabic text? Yes, this tool uses UTF-8, so Urdu, Arabic, Chinese and emoji all encode and decode correctly. Some older tools only handle English letters, so test first.

What is Base64 used for? It is used for email attachments, small images inside web pages (data URLs), API tokens, and sending binary data through text-only systems.

Why does my Base64 fail to decode? The most common reasons are a missing character, extra spaces or line breaks, or the text was never valid Base64. Copy the full string exactly and try again.

Is my text safe in this tool? Yes. Encoding and decoding happen in your browser only, so your text is never sent to a server or stored anywhere.

Related Tools

JSON Formatter · Word Counter · Password Generator