Base64 encoder/decoder – Online converter tools, Encode/Decode strings to Base64 and vice versa with interactive Base64 encoding algorithm by ConvertCodes.
Text
Base64
Optional: Upload file to encode / decode Base64
Remark: Base64 Encode / Decode input box limit 10,000 Characters. For a large data, please convert by upload a file. Please select MIME types of decoding output file, the default is text/plain or .txt file.
Base64 is a kind of data encryption. Base64 transform and encode original data to text format. These encode data is unreadable by a human. The method of Base64 encoding is encoded to replacing the data with 64 ASCII characters (Text characters). That why we call its Base64 encode.
Example – Encode string “Convert” to Base64.
- Convert string to 8 binary digits (Refer: Table ASCII – Binary Character)
Convert = 01000011 01101111 01101110 01110110 01100101 01110010 01110100
Letter | ASCII Code | Binary |
---|---|---|
C | 067 | 01000011 |
o | 111 | 01101111 |
n | 110 | 01101110 |
v | 118 | 01110110 |
e | 101 | 01100101 |
r | 114 | 01110010 |
t | 116 | 01110100 |
2. Rearrange group of bits by start from the left-hand side to each of 6 bits/group. For the last group, If the number of digits did not fit at 6 bits, add additional “00” digits to complete at 6 bits also.
*** Remark: Additional “00” equal to “=” which it needs to add at the end of codes.
Before: 01000011 01101111 01101110 01110110 01100101 01110010 01110100
After : 010000 110110 111101 101110 011101 100110 010101 110010 011101 000000
3. Convert new groups of binary bits to decimal numbers and encode by Base64 mapping table.
Binary | Decimal | Base64 |
---|---|---|
010000 | 16 | Q |
110110 | 54 | 2 |
111101 | 61 | 9 |
101110 | 46 | u |
011101 | 29 | d |
100110 | 38 | m |
010101 | 21 | v |
110010 | 50 | y |
011101 | 29 | d |
000000 | 0 | A |
Then you have to concatenate Base64 encoding string on the table to complete the sequence. Do not forget the “0000” that you have been added to the last group, so you have to add “==” to the end of Base64 result also.
Convert = "Q29udmVydA=="
Decoding Base64 data is to reverse the encoding Base64 process.
- Convert Base64 encoding data to binary 6 bits
- Rearrange 6 bits groups to 8 bits groups and ignore the last incomplete bits group.
- Convert binary 8 bits group back to ASCII.
Letter | ASCII Code | Binary | Letter | ASCII Code | Binary |
---|---|---|---|---|---|
a | 097 | 01100001 | A | 065 | 01000001 |
b | 098 | 01100010 | B | 066 | 01000010 |
c | 099 | 01100011 | C | 067 | 01000011 |
d | 100 | 01100100 | D | 068 | 01000100 |
e | 101 | 01100101 | E | 069 | 01000101 |
f | 102 | 01100110 | F | 070 | 01000110 |
g | 103 | 01100111 | G | 071 | 01000111 |
h | 104 | 01101000 | H | 072 | 01001000 |
i | 105 | 01101001 | I | 073 | 01001001 |
j | 106 | 01101010 | J | 074 | 01001010 |
k | 107 | 01101011 | K | 075 | 01001011 |
l | 108 | 01101100 | L | 076 | 01001100 |
m | 109 | 01101101 | M | 077 | 01001101 |
n | 110 | 01101110 | N | 078 | 01001110 |
o | 111 | 01101111 | O | 079 | 01001111 |
p | 112 | 01110000 | P | 080 | 01010000 |
q | 113 | 01110001 | Q | 081 | 01010001 |
r | 114 | 01110010 | R | 082 | 01010010 |
s | 115 | 01110011 | S | 083 | 01010011 |
t | 116 | 01110100 | T | 084 | 01010100 |
u | 117 | 01110101 | U | 085 | 01010101 |
v | 118 | 01110110 | V | 086 | 01010110 |
w | 119 | 01110111 | W | 087 | 01010111 |
x | 120 | 01111000 | X | 088 | 01011000 |
y | 121 | 01111001 | Y | 089 | 01011001 |
z | 122 | 01111010 | Z | 090 | 01011010 |
Index | Char | Index | Char | Index | Char | Index | Char | |||
---|---|---|---|---|---|---|---|---|---|---|
0 | A | 16 | Q | 32 | g | 48 | w | |||
1 | B | 17 | R | 33 | h | 49 | x | |||
2 | C | 18 | S | 34 | i | 50 | y | |||
3 | D | 19 | T | 35 | j | 51 | z | |||
4 | E | 20 | U | 36 | k | 52 | 0 | |||
5 | F | 21 | V | 37 | l | 53 | 1 | |||
6 | G | 22 | W | 38 | m | 54 | 2 | |||
7 | H | 23 | X | 39 | n | 55 | 3 | |||
8 | I | 24 | Y | 40 | o | 56 | 4 | |||
9 | J | 25 | Z | 41 | p | 57 | 5 | |||
10 | K | 26 | a | 42 | q | 58 | 6 | |||
11 | L | 27 | b | 43 | r | 59 | 7 | |||
12 | M | 28 | c | 44 | s | 60 | 8 | |||
13 | N | 29 | d | 45 | t | 61 | 9 | |||
14 | O | 30 | e | 46 | u | 62 | + | |||
15 | P | 31 | f | 47 | v | 63 | / |