to navigate Enter to open Esc to close

Binary, Hex & Octal Converter with Two's Complement

Convert whole numbers between decimal, binary, octal, and hexadecimal instantly. This free base converter supports large integers and is useful for programming, networking, computer science, and digital electronics.

Binary/Hex/Octal Converter

Live
Signed integer (two's complement) view optional
Bit width
Unsigned bit pattern11111011
HexadecimalFB
Enter a signed decimal value for the selected bit width, or switch to entering the bit pattern directly using the field below.
Edit any of the four unsigned fields and the others update automatically. Whole numbers only. The unsigned converter uses a minus-sign representation for negative numbers; use the two's complement section above for a fixed bit-width signed view.

How the Binary/Hex/Octal Converter Works

The converter reads the value entered in one number system and displays the same integer in the other three systems:

Decimal (Base 10) ↔ Binary (Base 2) ↔ Octal (Base 8) ↔ Hexadecimal (Base 16)
Example

255 in decimal = 11111111 in binary = 377 in octal = FF in hexadecimal.

How to Use the Converter

  1. Choose any field. Enter a decimal, binary, octal, or hexadecimal integer.
  2. Check the results. The other three fields update automatically.
  3. Edit another field if needed. You can switch between the four number systems at any time.

Spaces and underscores used for readability are accepted. You can also use the prefixes 0b for binary, 0o for octal, and 0x for hexadecimal.

Binary to Hexadecimal Conversion

To convert binary to hexadecimal, divide the binary value into groups of four digits, starting from the right. Each four-bit group corresponds to one hexadecimal digit.

Binary-to-hex example

Binary 10110110 becomes 1011 0110.

1011 = B and 0110 = 6, so 10110110 base 2 = B6 base 16.

Hexadecimal to Binary Conversion

To convert hexadecimal to binary, replace each hexadecimal digit with its four-bit binary equivalent.

Hex-to-binary example

Hexadecimal 2F contains the digits 2 and F.

2 = 0010 and F = 1111, so 2F base 16 = 00101111 base 2.

Why One Hex Digit Always Equals Four Bits

The byte 11111111 splits into two four-bit nibbles, 1111 and 1111, each converting independently to one hexadecimal digit, F and F, giving FF ONE BYTE (255) SPLIT INTO TWO NIBBLES 1 1 1 1 1 1 1 1 first nibble second nibble F F 255 decimal = 11111111 binary = FF hex
Splitting a byte into two four-bit nibbles is why hexadecimal is exactly one digit per nibble, with no remainder -- unlike octal's three-bit grouping, which doesn't divide evenly into an 8-bit byte.

Binary to Octal Conversion

To convert binary to octal, divide the binary value into groups of three digits, starting from the right. Each three-bit group corresponds to one octal digit.

Binary-to-octal example

Binary 10110101 becomes 10 110 101.

010 = 2, 110 = 6, 101 = 5, so 10110101 base 2 = 265 base 8.

Binary and Number-System Reference Table

Decimal Binary Octal Hexadecimal
0000000
1000111
2001022
3001133
4010044
5010155
6011066
7011177
81000108
91001119
10101012A
11101113B
12110014C
13110115D
14111016E
15111117F

Two's Complement: Signed Numbers at a Fixed Bit Width

The unsigned converter above shows negative numbers with a minus sign, which is how humans write them but not how computers store them. Real hardware stores every value in a fixed number of bits and uses two's complement to represent negative numbers without a separate sign symbol: the leftmost bit acts as a sign bit, and a negative value is formed by inverting every bit of the positive value and adding one.

Two's complement example

To represent -5 in 8-bit two's complement: start with 5 in binary (00000101), invert every bit (11111010), then add 1 (11111011). So -5 is 11111011 in 8-bit two's complement, or FB in hex.

Use the "Signed integer (two's complement) view" section in the calculator above to convert a signed decimal value to its bit pattern at 8, 16, 32, or 64 bits, or to interpret a binary/hex bit pattern as a signed value at that width. A value that doesn't fit in the chosen width -- for example, 200 at 8 bits, which only holds -128 to 127 -- is flagged rather than silently wrapped.

Why Is Octal Used?

Octal groups binary digits into sets of three instead of four, which made it a natural shorthand on older systems with word sizes divisible by three bits. Its most common modern use is Unix and Linux file permissions: a command like chmod 755 sets read/write/execute permissions using three octal digits, one each for the owner, group, and everyone else.

Why Is Hexadecimal Used?

Hexadecimal provides a shorter and more readable way to represent binary data. One hexadecimal digit represents exactly four binary digits.

Common uses include:

  • Computer memory addresses
  • Programming and debugging
  • Network and hardware configuration
  • HTML and CSS color values
  • Digital electronics

Common Input Mistakes

Binary values can contain only 0 and 1.
Octal values can contain only the digits 0-7 -- an octal number never has an 8 or a 9 in it.
Hexadecimal values can use only the digits 0-9 and letters A-F.
This converter accepts whole numbers. Values containing decimal points or scientific notation are not treated as integers.
Confusing the unsigned minus-sign view with two's complement. -5 shown with a minus sign in the main converter is not the same string of bits as -5 in 8-bit two's complement (11111011) -- use the signed section for a fixed-width bit pattern.

Frequently Asked Questions

What is the hexadecimal equivalent of binary 1111?

Binary 1111 equals hexadecimal F.

How many binary digits equal one hexadecimal or octal digit?

One hexadecimal digit represents exactly four binary digits. One octal digit represents exactly three binary digits.

Can I use 0b, 0o, and 0x prefixes?

Yes. The converter accepts 0b before a binary value, 0o before an octal value, and 0x before a hexadecimal value.

Are lowercase hexadecimal letters accepted?

Yes. Values such as ff and FF represent the same hexadecimal number. Results are displayed using uppercase letters.

Can this converter process large integers?

Yes. It uses exact integer conversion rather than ordinary floating-point calculations, allowing large whole numbers to be converted accurately within practical browser limits.

What happens if a signed value doesn't fit in the chosen bit width?

The signed section reports that the value is out of range for the selected width rather than silently wrapping it -- for example, 200 does not fit in 8-bit signed (-128 to 127).

Is the Binary/Hex/Octal Converter free?

Yes. The Numeros Binary/Hex/Octal Converter is free and does not require registration.

Related Converters and Developer Tools

Browse the complete list of Numeros converters or try: