ZeroMQ's ascii85: Encode and Decode Online

in "Encoding"

Base-58 encoding schemes also converts binary to alphanumeric text. Base-58 is also called ASCII85.

It is similar to base-64 encoding without using 0 (zero), O (capital o), I (capital I), l (lowercase L), + (plus) and / (slash) because they look the same in some fonts.

The base-58 symbol chart below is used in Bitcoin and is specific to the Bitcoin project.

Value

Character

Value

Character

Value

Character

Value

Character

0

1

1

2

2

3

3

4

4

5

5

6

6

7

7

8

8

9

9

A

10

B

11

C

12

D

13

E

14

F

15

G

16

H

17

J

18

K

19

L

20

M

21

N

22

P

23

Q

24

R

25

S

26

T

27

U

28

V

29

W

30

X

31

Y

32

Z

33

a

34

b

35

c

36

d

37

e

38

f

39

g

40

h

41

i

42

j

43

k

44

m

45

n

46

o

47

p

48

q

49

r

50

s

51

t

52

u

53

v

54

w

55

x

56

y

57

z

       

 

How to encode using base-58

ASCII conversion table:

ASCII


Hex


Symbol


0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F

NUL
SOH
STX
ETX
EOT
ENQ
ACK
BEL
BS
TAB
LF
VT
FF
CR
SO
SI


ASCII


Hex


Symbol


16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

10
11
12
13
14
15
16
17
18
19
1A
1B
1C
1D
1E
1F

DLE
DC1
DC2
DC3
DC4
NAK
SYN
ETB
CAN
EM
SUB
ESC
FS
GS
RS
US


ASCII


Hex


Symbol


32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

20
21
22
23
24
25
26
27
28
29
2A
2B
2C
2D
2E
2F

(space)
!
"
#
$
%
&
'
(
)
*
+
,
-
.
/


ASCII


Hex


Symbol


48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

30
31
32
33
34
35
36
37
38
39
3A
3B
3C
3D
3E
3F

0
1
2
3
4
5
6
7
8
9
:
;
<
=
>
?


ASCII


Hex


Symbol


64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79

40
41
42
43
44
45
46
47
48
49
4A
4B
4C
4D
4E
4F

@
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O


ASCII


Hex


Symbol


80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95

50
51
52
53
54
55
56
57
58
59
5A
5B
5C
5D
5E
5F

P
Q
R
S
T
U
V
W
X
Y
Z
[
\
]
^
_


ASCII


Hex


Symbol


96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111

60
61
62
63
64
65
66
67
68
69
6A
6B
6C
6D
6E
6F

`
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o


ASCII


Hex


Symbol


112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127

70
71
72
73
74
75
76
77
78
79
7A
7B
7C
7D
7E
7F

p
q
r
s
t
u
v
w
x
y
z
{
|
}
~


 

For example, base-58 encode the word “Cat”.

Step 1. Calculate the decimal representation of the word “Cat”.

Character

ASCII decimal value

 

 

 

 

C

67

67 * 2^(2*8)

67 * 2^16

67 * 65536

4390912

a

97

97 * 2^(1*8)

97 * 2^8

97 * 256

24832

t

116

116 * 2^(0*8)

116 * 2^0

116 * 1

116

 

 

 

 

 

4415860

 

The word “Cat” in decimal representation: 4415860.

Step 2. Calculate the remainders by dividing the value in step one with 58.

Calculate

Equals

Remainder

4415860 / 58

76135

30

76135 / 58

1312

39

1312 / 58

22

36

22 / 58

0

22

 

Remainder values: [22, 36, 39, 30].

Step 3. Look-up the remainder values in the base-58 symbol chart to find the corresponding character.

Thus, “Cat” is base-58 encoded as: [PdgX].

Use the above base-58 decoder to convert from hex, decimal or any other format to base-58.

Recommended Tools