How to convert Text to Base64
Encoding text to Base64 happens in two steps. First the text is turned
into bytes using UTF-8, so an ASCII letter is one byte and an accented or
non-Latin character is two or more. Those bytes are then taken three at a time —
24 bits — and split into four 6-bit groups, each of which selects one character
from the 64-character Base64 alphabet. When the byte count is not a multiple of
three, one or two = characters pad the final block.
Worked example
Take the text Cat. In UTF-8 that is the three bytes 43 61 74.
- Write the bytes as 24 bits:
01000011 01100001 01110100. - Regroup into four 6-bit values:
010000 110110 000101 110100= 16, 54, 5, 52. - Index the Base64 alphabet:
Q,2,F,0. - Result:
Q2F0.
When the length is not a multiple of three, padding appears: Cats encodes to Q2F0cw==.
The Base64 alphabet
| Value | Character |
|---|---|
| 0 | A |
| 1 | B |
| 2 | C |
| 3 | D |
| 4 | E |
| 5 | F |
| 6 | G |
| 7 | H |
| 8 | I |
| 9 | J |
| 10 | K |
| 11 | L |
| 12 | M |
| 13 | N |
| 14 | O |
| 15 | P |
| 16 | Q |
| 17 | R |
| 18 | S |
| 19 | T |
| 20 | U |
| 21 | V |
| 22 | W |
| 23 | X |
| 24 | Y |
| 25 | Z |
| 26 | a |
| 27 | b |
| 28 | c |
| 29 | d |
| 30 | e |
| 31 | f |
| 32 | g |
| 33 | h |
| 34 | i |
| 35 | j |
| 36 | k |
| 37 | l |
| 38 | m |
| 39 | n |
| 40 | o |
| 41 | p |
| 42 | q |
| 43 | r |
| 44 | s |
| 45 | t |
| 46 | u |
| 47 | v |
| 48 | w |
| 49 | x |
| 50 | y |
| 51 | z |
| 52 | 0 |
| 53 | 1 |
| 54 | 2 |
| 55 | 3 |
| 56 | 4 |
| 57 | 5 |
| 58 | 6 |
| 59 | 7 |
| 60 | 8 |
| 61 | 9 |
| 62 | + |
| 63 | / |
Frequently asked questions
- How do I convert Base64 back to Text?
- Use the Base64 to Text converter, or just type into the matching pane above — every pane is editable and the others update to match.
- Is my data sent to a server?
- No. All encoding and decoding happens in your browser, so you can safely convert tokens, keys, or anything else sensitive.
- Does this handle non-ASCII text?
- Yes. Text is encoded as UTF-8, so accented letters, emoji, and non-Latin scripts convert correctly — the hex pane always shows you the exact bytes.