Base64 Encoder/Decoder
Encode and decode text to/from Base64 format
📖 What is Base64?
Base64 is a binary-to-text encoding scheme that represents binary data in ASCII string format.
- • Uses 64 characters (A-Z, a-z, 0-9, +, /)
- • Commonly used in email, JSON, XML
- • Encodes 3 bytes into 4 characters
- • Safe for transmission over text protocols
💡 Common Use Cases
- • Embedding images in HTML/CSS
- • Storing binary data in JSON
- • Email attachments (MIME)
- • API authentication tokens
- • Data URIs for web resources
- • Encoding credentials in HTTP headers
Overview
This Base64 encoder and decoder converts text to Base64 and back again in your browser. Base64 is a binary-to-text encoding that represents any data using 64 safe characters — A–Z, a–z, 0–9, + and / — with = used for padding. Developers use it to embed small images in data URIs, put binary data inside JSON or XML, read email attachments in MIME format and inspect values in HTTP headers or tokens.
Encoding works on bytes, so the tool first converts your text to UTF-8, which means accented letters, non-Latin scripts and emoji all encode correctly. Every 3 bytes of input become 4 Base64 characters, so the output is about 33% larger than the original. When decoding, the tool ignores spaces and line breaks, accepts the URL-safe alphabet (- and _ instead of + and /) and adds missing = padding automatically.
Base64 is an encoding, not encryption. Anyone can decode it, so never treat a Base64 string as a way to hide passwords or other secrets.
How to Use
- Choose Encode to Base64 or Decode from Base64 at the top.
- Type or paste your content into the Text to Encode or Base64 to Decode box.
- Click Encode or Decode. If the input is empty or is not valid Base64, an error message explains the problem.
- Read the result in the Encoded Base64 or Decoded Text box and click Copy to put it on your clipboard.
- Click Swap to move the result into the input box and switch modes, which is a quick way to check a round trip.
Frequently Asked Questions
How does Base64 encoding work?
Base64 takes the input bytes three at a time (24 bits) and splits them into four 6-bit groups. Each 6-bit value, from 0 to 63, is mapped to one character of the Base64 alphabet. For example, the text "Man" is the bytes 77, 97, 110, which become the four characters TWFu. If the input is not a multiple of three bytes, = padding fills out the last group.
What does the = sign at the end of Base64 mean?
The = characters are padding that keeps the output length a multiple of four. One leftover byte produces two characters plus ==, and two leftover bytes produce three characters plus =. So "Hello" (5 bytes) encodes to SGVsbG8= and "Ma" encodes to TWE=, while "Hi!" (exactly 3 bytes) encodes to SGkh with no padding. This decoder will add missing padding for you if it was stripped.
Is Base64 a form of encryption?
No. Base64 is a reversible encoding with a public, fixed alphabet and no key, so anyone can decode it instantly. For instance, HTTP Basic authentication sends "user:pass" as dXNlcjpwYXNz, which offers no protection on its own — that is why it must be used over HTTPS. To protect data, use real encryption; use Base64 only to move bytes safely through text-based systems.
Why is Base64 output larger than the input?
Each Base64 character carries only 6 bits of information, while each input byte has 8. Four output characters are needed for every three input bytes, so the encoded result is about 4/3 the original size — roughly 33% larger, plus up to two padding characters. A 30 KB image becomes about 40 KB when embedded as a Base64 data URI, which is why it suits small assets best.
What is URL-safe Base64?
Standard Base64 uses + and /, which have special meanings in URLs and file names. The URL-safe variant described in RFC 4648 replaces them with - and _ and often drops the = padding. It is used in JSON Web Tokens and many web APIs. This decoder accepts both alphabets automatically, while the encoder outputs standard Base64 with padding.
Can I encode emoji and non-English text?
Yes. The encoder converts text to UTF-8 bytes before encoding, so characters outside basic ASCII work correctly. The word "café" becomes Y2Fmw6k=, because é takes two bytes in UTF-8. When decoding, the tool interprets the bytes as UTF-8 text; if they are not valid UTF-8 — for example, an encoded image or other binary file — it displays the raw bytes as Latin-1 characters instead.