Base Converter
Pick a bit width (8/16/32/64-bit), then type a number into any of the binary, octal, decimal, or hexadecimal fields, and the other three update instantly. Negative numbers convert using the two's complement representation for the selected bit width (e.g. with 8 bits, decimal "-1" becomes binary "11111111" and hex "FF"). Only the decimal field accepts a signed value with a leading "-"; the binary, octal, and hex fields represent the raw bit pattern itself (0x/0b/0o-prefixed input is accepted there) and have no sign. Large numbers convert without losing precision. If you also work with bitwise networking values, try the CIDR / Subnet Calculator.
🔒 Runs in your browser · Your data is never sent to a server
Notes
- Negative numbers are converted using two's complement for the selected bit width. Enter a signed value (e.g. -1) in the decimal field, and the binary, octal, and hex fields show the corresponding bit pattern for that width (e.g. -1 at 8 bits is binary "11111111").
- The binary, octal, and hex fields don't accept a sign (+/-), since they represent the raw bit pattern itself. Only the decimal field accepts a signed value.
- Changing the bit width also changes the range of values a signed integer can represent (e.g. -128 to 127 for 8 bits). If the current decimal value no longer fits the new bit width, an error is shown so you can adjust it.
- This tool uses BigInt internally, so values up to 64 bits convert without losing precision.
- You can prefix your input with "0xFF", "0b1111", or "0o17" — the converted results themselves are shown without a prefix.
Glossary
Binary
A base-2 number system using only the digits 0 and 1 — it maps directly to the bit patterns a computer works with internally.
Octal
A base-8 number system using the digits 0-7. Each octal digit maps to exactly 3 binary digits, and it shows up in things like UNIX file permissions (e.g. chmod 755).
Hexadecimal
A base-16 number system using the digits 0-9 and letters A-F. Each hex digit maps to exactly 4 binary digits, and it shows up in color codes (e.g. #FF0000) and memory addresses.
Two's complement
The standard way computers represent negative integers in bits. At a given bit width (e.g. 8 bits), a negative value v is represented by the bit pattern for "2^width + v". For example, at 8 bits, -1 is "256 + (-1) = 255", which is "11111111" in binary. This representation lets addition and subtraction work correctly using ordinary bitwise arithmetic.
Bit width (8/16/32/64-bit)
How many bits are used to represent an integer in a fixed-length form. It determines the range a signed integer can hold (e.g. -128 to 127 at 8 bits, -32768 to 32767 at 16 bits) — matching integer types in programming languages such as int8 or int32.
BigInt
JavaScript's data type for arbitrary-precision integers, letting you work with very large whole numbers that the regular Number type cannot represent exactly.
FAQ
How are negative numbers converted?
They are converted using two's complement at the selected bit width. For example, decimal -1 at 8 bits becomes 11111111 in binary and FF in hex. Changing the bit width changes the representation of the same value.
Can I enter values with prefixes such as 0x or 0b?
Yes. You can enter hexadecimal with "0x", binary with "0b" and octal with "0o". Letters can be upper or lower case.
Can it convert large 64-bit values accurately?
Yes. The tool uses BigInt internally, so values across the full 64-bit range are converted exactly, without the rounding errors that regular JavaScript numbers would introduce.
Share this page
