Number Base Converter
Type a whole number, say which base it is written in, and see it in binary, octal, decimal and hexadecimal, plus any other base from 2 to 36. Large numbers are converted exactly, without the rounding errors that ordinary floating-point numbers have.
In base 36
73
Needs 8 bits (1 byte) for its size, without the sign.
| Base | Value |
|---|---|
| Binary (2) | 1111 1111 |
| Octal (8) | 377 |
| Decimal (10) | 255 |
| Hexadecimal (16) | FF |
How it works
- Type the number. Spaces and underscores are ignored, and 0x, 0b or 0o prefixes are accepted for their base.
- Choose the base the number is written in.
- Choose one extra base to show, for example 36.
- Read the table, then copy the binary, decimal or hexadecimal value.
What people use it for
Programming and debugging
Read a hexadecimal address or a bit mask as decimal and binary.
Computer science homework
Check a conversion done by hand, including the size in bits.
Short identifiers
Write a large number in base 36 to get a shorter code that uses digits and letters.
Questions
- Which digits are allowed?
- In base b, the digits 0 to b − 1, written with letters for 10 and above: A = 10, B = 11 and so on up to Z = 35. Letters can be typed in lowercase or uppercase. A digit that does not exist in the base is named in the error message.
- Are big numbers exact?
- Yes. The conversion uses whole-number arithmetic with no size limit other than 400 typed characters, so 2^64 is read as 18446744073709551616 and not rounded as a JavaScript number would be.
- What about negative numbers and fractions?
- A minus sign is kept in front of the result (-255 in hex is -FF). This is not the two's complement form used inside computers. Fractions such as 0.5 are not accepted: only whole numbers are converted.
- What is the size in bits?
- The number of binary digits needed for the size of the number without its sign: 255 needs 8 bits (1 byte), 256 needs 9 bits (2 bytes). Zero is counted as 1 bit.