0

Decoded

Base64

Encoded

Base64
Line Break

About Base64

Base64 is an encoding method that uses 7-bit printable ASCII characters. Mainly used in email to transfer 8-bit data over a 7-bit data path.

In Base64, data is divided into 6 bits and converted into alphanumeric characters (A-Z, a-z, 0-9) and symbols (+, /). Converts every 4 characters, and if the last is less than 4 characters, pad with the equal symbol (=).

In addition, RFC 1421 (PEM: Privacy-Enhanced Mail) stipulates line breaks every 64 characters, and RFC 2045 (MIME) stipulates line breaks every 76 characters.

The conversion table for Base64 characters is as follows.

6-bit dataBase64 character
000000A
000001B
000010C
000011D
000100E
000101F
000110G
000111H
001000I
001001J
001010K
001011L
001100M
001101N
001110O
001111P
010000Q
010001R
010010S
010011T
010100U
010101V
010110W
010111X
011000Y
011001Z
011010a
011011b
011100c
011101d
011110e
011111f
100000g
100001h
100010i
100011j
100100k
100101l
100110m
100111n
101000o
101001p
101010q
101011r
101100s
101101t
101110u
101111v
110000w
110001x
110010y
110011z
1101000
1101011
1101102
1101113
1110004
1110015
1110106
1110117
1111008
1111019
111110+
111111-

For example, if you convert "Hello" with Base64, it will be as follows.

1. Make it a binary representation.

01001000 01100101 01101100 01101100 01101111  (For US-ASCII / UTF-8)

2. Separate every 6 bits. If it is less than 6 bits, pad it with "0" at the end.

010010 000110 010101 101100 011011 000110 111100

3. Convert to characters using a conversion table. Convert every 4 characters, and if it is less than 4 characters, pad the end with "=".

SGVs bG8=

4. Connect all the characters to get the Base64 conversion result.

SGVsbG8=

Email MIME message header type (RFC 2047)

DenCode also supports decoding of MIME message header format (RFC 2047), such as below. This format is used when the subject, recipient, etc. of the email contains non-ASCII characters.

Subject: =?UTF-8?B?44K144Oz44OX44Or?=

The result after decoding is as follows.

Subject: サンプル