This base converter changes data between hex, Base32, Base64 and Base64url, and turns whole numbers between any bases from 2 to 36. Paste text or an encoded value, choose what it is and what you want, and the result appears with every other encoding listed beneath it, so one conversion gives you all the common forms. It also handles huge integers exactly, and all of it runs in your browser.
How to use the base converter
- Choose Data or Number. Data is for text and encoded bytes. Number is for whole numbers written in a base.
- Type or paste the input.
- Select the From and To formats, or the two bases.
- Press Convert and copy the result.
Hex, Base32 and Base64 in brief
Hex, Base32 and Base64 are three ways to write the same bytes using printable characters. RFC 4648 defines them. Base64 uses A to Z, a to z, 0 to 9, plus and slash, and each character carries 6 bits, so 3 bytes become 4 characters. [1] Base32 uses A to Z and 2 to 7, so 5 bytes become 8 characters, and it is case-insensitive. [1] Hex is Base16, with 2 characters for each byte and no padding. [1] The longer the alphabet, the shorter the text, so Base64 is the most compact and hex the easiest to read.
| Format | Alphabet | Size growth |
|---|---|---|
| Hex (Base16) | 0 to 9, A to F | 2 characters per byte |
| Base32 | A to Z, 2 to 7, padded with = | 8 characters per 5 bytes |
| Base32hex | 0 to 9, A to V | 8 characters per 5 bytes |
| Base64 | A to Z, a to z, 0 to 9, + and / | 4 characters per 3 bytes |
| Base64url | Same, with - and _ | 4 characters per 3 bytes, padding usually dropped |
Base64url and Base32hex
Base64url replaces the plus and slash with a hyphen and an underscore so the text can sit safely in a web address or a file name. RFC 4648 says it should not be regarded as the same as ordinary Base64. [1] Base32hex uses the digits 0 to 9 followed by A to V, and its main property is that encoded values keep their sort order. [1] This converter reads and writes padding with equals signs for Base32 and Base64 and leaves it off for Base64url.
Converting numbers between bases
In a positional system with base b, every digit is worth a power of b, and the highest digit is one less than the base. [2] Beyond 9, letters supply the extra digits, so in hexadecimal A to F stand for 10 to 15. [2] To convert to decimal you multiply and add digit by digit, and to convert out of decimal you divide repeatedly by the target base and read the remainders. [2] This tool uses arbitrary-size integers, so a 40-digit number converts exactly, which an ordinary calculator would round. Digits run 0 to 9 and then a to z, giving bases up to 36.
Base converter examples
- The text hello is 68656c6c6f in hex, NBSWY3DP in Base32 and aGVsbG8= in Base64.
- The bytes fb ff fe are +//+ in Base64 and -__- in Base64url.
- The decimal number 255 is ff in base 16, 11111111 in base 2 and 73 in base 36.
- The base 36 number zz is 1295 in decimal.
Why a base converter returns an error
Each format has strict rules. Hex needs an even number of digits made from 0 to 9 and a to f. Base32 and Base64 must use only their own characters and a valid length, and any leftover bits at the end must be zero. A number with a digit that does not exist in its base, such as a 9 in base 8, cannot be read. If you choose Text as the output, the bytes must also form valid UTF-8, otherwise pick hex or Base64 to see them.
When to use each format
Choose hex when people need to read or compare bytes, for example checksums, colour codes and memory dumps. Choose Base64 to carry binary data inside text, such as an image in a data address or a token in an e-mail header. Choose Base64url when the value goes in a web address, a cookie or a file name. Choose Base32 when people must type a code by hand, because it avoids lower-case letters and confusing digits. Choose Base32hex when sorting the encoded values must match sorting the raw bytes.
How the data conversion works
The tool first turns whatever you typed into bytes. Text becomes UTF-8 bytes, and hex, Base32 and Base64 are decoded back to the bytes they stand for. It then writes those same bytes in every other format. Because everything passes through bytes, a value can be moved between any two formats without loss. The table under the result also shows the byte count and, for short inputs, the bytes read as one whole number, which helps when you are checking a key or an identifier.
Tips for reliable results
- Remove any prefix such as 0x if the tool does not accept it, although hex input here allows it.
- Check that Base64 text has not been cut off: its length should divide evenly once padding is counted.
- Use Number mode for values like 3f or zz, and Data mode for strings that stand for bytes.
Common mistakes
- Mixing Base64 and Base64url. Characters that are valid in one are not valid in the other.
- Treating encoding as encryption. Anyone can decode Base64 or hex, so it hides nothing.
- Forgetting the character set. This tool turns text into UTF-8 bytes first, so accented letters take more than one byte.
- Entering decimals. Only whole numbers convert between bases here.
Privacy
The page converts your input with code that runs on your device. Nothing is sent to a server, so it is safe to use with tokens, keys and other private strings, though you should still avoid pasting secrets you do not need to.
What next
Use this often? Add Base Convert to your Home screen.
Frequently asked questions
What does a base converter do?
A base converter changes the way a value is written. For data it switches between text, hex, Base32 and Base64. For numbers it switches between bases from 2 to 36.
What is the difference between Base64 and Base64url?
Base64url swaps the plus and slash for a hyphen and an underscore and usually drops the equals padding, so it can be used in web addresses and file names.
Can this base converter handle very large numbers?
Yes. It uses arbitrary-size integers, so long numbers convert exactly. Decimal points are not supported.
Is Base64 encryption?
No. Base64, Base32 and hex are only ways of writing bytes as text. Anyone can reverse them, so they give no secrecy.
Is my input sent anywhere?
No. The conversion runs entirely in your browser.
Was this tool helpful?
What went wrong?
We only receive the reason you pick, never what you typed into the tool.
Thanks for your feedback.