How to use the base58 encoder and decoder
- Choose Encode or Decode.
- To encode, type text or enter hex bytes.
- To decode, paste Base58. Spaces and line breaks are ignored.
- Read the result, the number of bytes, the length of the encoding and the bytes as hex.
Formula
read the bytes as one large number, first byte most significant
divide by 58 again and again; each remainder picks one of 58 characters: 1 to 9, A to Z without I and O, a to z without l
write one leading 1 for each leading zero byte
The alphabet leaves out 0 (zero), O (capital o), I (capital i) and l (lowercase L) because they look alike. There is no padding, and no checksum is added by this page.
Two examples
The text "hello world" is the bytes 68 65 6c 6c 6f 20 77 6f 72 6c 64, which encode to StV1DL6CwTryKyV. Decoding that text returns the same bytes and the original words.
The bytes 00 00 28 7f b4 cd start with two zero bytes. The number 0x287fb4cd encodes to 233QC4, and the two leading zero bytes add two 1 characters, giving 11233QC4. Without the rule for leading zeros, the zeros would be lost when decoding.
Why Base58
Base58 was designed for identifiers that people copy by hand. It drops the characters that are easy to confuse and avoids the plus and slash signs that break double-click selection in many apps, so an address or key can be selected as one word. It is longer than Base64 for the same data, about 1.37 characters per byte.
Variants and checks
This page uses the common Bitcoin-style alphabet. Other Base58 alphabets exist, such as the one used by Flickr, and some formats add a checksum so a typing mistake is caught. This page does neither, so a decoded result is only the bytes behind the text. Base58 is a way to write bytes as text, not encryption. See also the Base64 Encoder and Decoder, the Base32 Encoder and Decoder and the Hex Viewer. Nothing leaves your browser.
Assumptions and limits
- Text is encoded as UTF-8 bytes.
- The alphabet is fixed and no checksum is used.
- Input is limited to 200,000 characters.
- Nothing is sent from your device.
Frequently asked questions
Why are 0, O, I and l missing?
They are easy to mistake for one another in many fonts. Leaving them out makes typing and reading an identifier by hand less error-prone.
Why does a leading zero byte become the character 1?
The character 1 stands for the value zero in the alphabet. Because a number cannot keep its leading zeros, each leading zero byte is written as one 1 so that decoding can restore it.
Can I decode a Bitcoin address?
You can decode the characters to bytes, but an address also contains a version byte and a checksum that this page does not check or remove. The result is the raw bytes.
Is Base58 more efficient than Base64?
No. It takes about 1.37 characters per byte against 1.33 for Base64, and it is slower to compute because it divides a large number. Its advantage is readability.