B*

Base N Encoder and Decoder

Encode bytes into any base from 2 to 256 using a custom alphabet of your choice. Supply the character set, choose encode or decode, and get a deterministic round-trip with arbitrary radices.

Runs in your browser ⚑ REST API available 🧩 Embeddable
Output
1wJfrzvdbtXUOlUjUf
Preset alphabets
Base 2 Binary 2 chars
01
Base 8 Octal 8 chars
01234567
Base 16 Hex (lowercase) 16 chars
0123456789abcdef
Base 36 Digits + lowercase 36 chars
0123456789abcdefghijklmnopqrstuvwxyz
Base 62 Default β€” alphanumeric 62 chars
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
Base 94 All printable ASCII (no space) 94 chars
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~

Copy any of these into the alphabet field above, or paste your own. The alphabet must contain at least 2 unique characters and at most 256.

What is Base N?

Base N takes any alphabet between 2 and 256 unique characters and uses it to encode bytes. Each input string is read as UTF-8, treated as a single big integer, and rewritten as digits in your chosen base. The first character of the alphabet acts as the leading-zero placeholder, the same way 1 does in Bitcoin Base58.

The default alphabet shown above is Base62 (digits + letters), but you can paste any unique character set: hex (0123456789abcdef), an emoji set, custom Crockford with a checksum row, or even Unicode symbols. Decoding requires the exact same alphabet that was used to encode.

Tips and gotchas

The alphabet must be free of duplicates β€” 0123456789 works, but 0123456788 doesn't. Whitespace counts as a character, so leading or trailing spaces in the alphabet field can change the encoding silently.

There's no padding and no length prefix. The encoded string is the shortest representation that round-trips, plus one alphabet[0] for each leading zero byte in the input. Strings with multi-byte characters (emoji, kanji) work fine β€” they're encoded as their UTF-8 bytes.

Use the API

Call the same encoder server-side or from another origin. CORS is open, no auth required for the free tier.

curl "https://encode-decode.org/api/v1/basen\
?action=encode&input=Hello%20World&alphabet=0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"