Number Base Converter
About the Number Base Converter
This number base converter translates integers between binary, octal, decimal and hexadecimal at the same time: type into any of the four fields and the other three update instantly. It handles numbers of any size and negative values, so 64-bit IDs, bit masks and long hex strings convert without losing precision.
How number bases work
A base (or radix) is the number of distinct digits a system uses. Each position is worth the base raised to a power, counting from 0 on the right. In hexadecimal, 2A means 2 × 16 + 10 = 42; in binary, 101010 means 32 + 8 + 2 = 42.
Decimal uses digits 0-9, binary only 0 and 1, octal 0-7, and hexadecimal 0-9 plus A-F for the values 10 to 15.
Binary, octal and hex conversion examples
Hexadecimal maps neatly onto binary because one hex digit is exactly 4 bits. FF is 1111 1111, which is 255 in decimal, the largest value a single byte can hold. That is why colors (#FF8800), memory addresses and byte dumps are written in hex.
Octal groups 3 bits per digit, which is how Unix file permissions are written. chmod 755 is octal for binary 111 101 101, meaning rwx r-x r-x, and equals 493 in decimal.
Large and negative numbers
JavaScript numbers lose precision above 2^53 - 1 (9007199254740991), which can silently corrupt 64-bit database IDs or Twitter-style snowflake IDs. This converter uses BigInt, so a value like 18446744073709551615 converts to FFFFFFFFFFFFFFFF exactly.
Negative numbers are shown with a minus sign in every base: -42 is -101010 in binary and -2A in hex. This is sign-and-magnitude notation, not the two's complement bit pattern a CPU stores, so to get the 8-bit representation of -42 (11010110), convert 256 - 42 = 214 instead.
How to Use the Number Base Converter
- Click into the Binary, Octal, Decimal or Hexadecimal field, whichever base your number is in.
- Type or paste the number. Prefixes such as 0b, 0o and 0x are accepted, and spaces and underscores (1111_0000) are ignored.
- Read the other three fields, which update on every keystroke. Hexadecimal output is shown in uppercase.
- If you type a digit that is not valid for that base, such as 8 in octal, an error explains which character is wrong.
- Click Copy on any card to copy its value, or Reset All to clear every field.
Frequently Asked Questions
- Is anything I enter sent to a server?
- No. Conversion runs in your browser with JavaScript BigInt, and nothing is stored or transmitted.
- How do I convert hex to decimal by hand?
- Multiply each digit by 16 raised to its position (from 0 on the right) and add the results. 1F is 1 × 16 + 15 = 31.
- Is there a size limit?
- No fixed limit. Values are handled as arbitrary-precision integers, so very large numbers convert exactly, limited only by your browser's memory.
- Can I convert fractions or decimals like 3.75?
- No. The converter works with whole integers only; a decimal point is reported as an invalid character.
- Why is -42 shown as -101010 and not 11010110?
- The tool keeps the sign separate from the magnitude. 11010110 is the 8-bit two's complement form, which depends on the bit width; you get it by converting 256 - 42 = 214.
- Is hexadecimal case-sensitive?
- No. ff, FF and Ff are all 255. Output is shown in uppercase for readability.