Instantly convert between decimal, binary, octal and hexadecimal number systems with two's complement support.
Valid range (signed): -128 to 127
A binary converter translates numbers between the positional number systems computers use internally. The four most common bases are decimal (base-10, used by humans), binary (base-2, used by computers), octal (base-8, used in Unix file permissions) and hexadecimal (base-16, used in colour codes and memory addresses).
Understanding these systems is fundamental to computer science, digital electronics and low-level programming. Every file, image and network address ultimately boils down to sequences of 0s and 1s.
The value of any number in a positional system is the sum of each digit multiplied by the base raised to the power of its position.
For two's complement, invert all bits and add 1 to obtain the negative representation within a fixed bit width. This allows the same arithmetic hardware to handle both positive and negative numbers.
The letter 'A' has ASCII code 65. In 8-bit binary: 0100 0001. In hex: 0x41. In octal: 101. Knowing this mapping is essential for low-level text processing.
The common subnet mask 255.255.255.0 means each octet is 1111 1111 in binary. The CIDR notation /24 refers to the 24 leading 1-bits that define the network portion.
HTTP traffic uses TCP port 80, which is 0101 0000 in 8-bit binary and 50 in hex. Firewall rules and packet filters often work directly at the binary or hex level.
A single RGB channel stores values 0–255. Pure red in CSS is #FF0000, where FF is 1111 1111 in binary — the maximum value for an 8-bit field.
Type or paste a value in any of the four input fields (decimal, binary, octal or hexadecimal).
Select the bit width that matches your target system (e.g. 8-bit for a byte, 32-bit for a typical integer).
The converter parses your input for the chosen base, validating digits and the signed range.
The decimal equivalent is derived, then re-expressed in all other bases simultaneously.
Negative decimals are shown in two's complement binary for the selected bit width, with the corresponding octal and hex values.
Digital hardware is built from transistors that switch between two stable states (on/off, high/low voltage). Representing these two states as 1 and 0 is simple and reliable. Decimal would require ten stable states per digit, which is far harder to implement in silicon.
Two's complement is the standard method for encoding negative integers in binary. To negate a number, invert all its bits and add 1. Its key advantage is that addition hardware works identically for positive and negative numbers, so CPUs do not need separate subtraction circuits.
Group the binary digits into nibbles of four from the right, padding with leading zeros if needed. Each nibble maps directly to a single hex digit: 0000=0, 0001=1, …, 1010=A, 1011=B, 1100=C, 1101=D, 1110=E, 1111=F.
Unsigned binary treats all bits as magnitude, giving a range of 0 to 2ⁿ−1. Signed binary (two's complement) reserves the most significant bit as a sign bit, giving a range of −2ⁿ⁻¹ to 2ⁿ⁻¹−1. This converter uses the signed interpretation.
A byte (8 bits) is always exactly two hex digits, making hex far more compact and readable than long binary strings. Memory dumps, colour codes (#RRGGBB) and bitfield masks are all conventionally written in hex.
Bit width determines how many binary digits represent a number and defines the valid signed range. An 8-bit field holds one byte (range −128 to 127). A 16-bit field holds two bytes (range −32,768 to 32,767). Choosing the correct width avoids overflow errors in your code.