Free forever · No sign-up
Base64 Encode
Encode any text to Base64 instantly — UTF-8 safe, emoji supported. Free, fast, no sign-up.
Your data stays in your browser.
No recent conversions yet.
Step-by-step calculation
| Bytes | 24 bits | Base64 |
|---|
How Base64 encoding works
- Text is converted to its UTF-8 bytes.
- Bytes are split into groups of 3 (24 bits).
- Each group becomes 4 Base64 characters (6 bits each); '=' pads the end.
Example: "Hi" → 48 69 → SGk=.
Background reading: the Base64 encoding scheme on Wikipedia.
Base64 alphabet
The 64 characters of the Base64 alphabet and their 6-bit values (0–63).
| Char | Value | Char | Value | Char | Value | Char | Value |
|---|---|---|---|---|---|---|---|
| A | 0 | B | 1 | C | 2 | D | 3 |
| E | 4 | F | 5 | G | 6 | H | 7 |
| I | 8 | J | 9 | K | 10 | L | 11 |
| M | 12 | N | 13 | O | 14 | P | 15 |
| Q | 16 | R | 17 | S | 18 | T | 19 |
| U | 20 | V | 21 | W | 22 | X | 23 |
| Y | 24 | Z | 25 | a | 26 | b | 27 |
| c | 28 | d | 29 | e | 30 | f | 31 |
| g | 32 | h | 33 | i | 34 | j | 35 |
| k | 36 | l | 37 | m | 38 | n | 39 |
| o | 40 | p | 41 | q | 42 | r | 43 |
| s | 44 | t | 45 | u | 46 | v | 47 |
| w | 48 | x | 49 | y | 50 | z | 51 |
| 0 | 52 | 1 | 53 | 2 | 54 | 3 | 55 |
| 4 | 56 | 5 | 57 | 6 | 58 | 7 | 59 |
| 8 | 60 | 9 | 61 | + | 62 | / | 63 |
Base64 encoding in code
Python
import base64
base64.b64encode("Hi 👋".encode()).decode()
# → 'SGkg8J+Riw=='
JavaScript
btoa(unescape(encodeURIComponent("Hi 👋")));
// → 'SGkg8J+Riw=='
C
/* C has no standard-library Base64. The usual approach:
1. Take the 64-character alphabet:
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
2. Split the input bytes into 6-bit groups; each group (0-63)
is an index into the alphabet.
3. Every 3 input bytes become 4 output characters; pad the
final group with '='. Example: "Hi" -> 0x48 0x69
-> 6-bit groups 18, 6, 36 -> "SGk=". */
Common values
- “Hi” →
SGk= - “Man” →
TWFu - “A” →
QQ== - “AB” →
QUI= - empty string → empty string
Key takeaways
- Base64 packs 3 bytes into 4 ASCII characters — output grows about 33%.
- The alphabet is A–Z, a–z, 0–9, +, / with = padding.
- It is an encoding, not encryption — anyone can decode it.
- Use the URL-safe variant (– and _) inside URLs.
Frequently asked questions
What is Base64?
Base64 turns binary data into plain ASCII text using 64 safe characters — handy for embedding data in JSON, URLs and emails.
Does it support emoji?
Yes — the encoder is UTF-8 safe, so emoji and non-Latin scripts encode correctly.
Is Base64 encryption?
No — anyone can decode it. It encodes data for transport, it doesn't protect it.
Why does Base64 output end with =?
= is padding — it fills the last 4-character group when the input is not a multiple of 3 bytes.
How much bigger is Base64 than the original?
About 33% bigger — every 3 bytes become 4 characters.
What characters are used in Base64?
A–Z, a–z, 0–9, + and / (64 total), plus = for padding. See the alphabet table above.
Is Base64 safe for URLs?
Standard Base64 is not — + and / have special meaning in URLs. URL-safe Base64 swaps them for – and _.
Need to decode? Try our Base64 decoder.