Binary / Hex Converter
Convert between binary, octal, decimal, and hexadecimal instantly. Step-by-step conversion shown. Essential for computer science, programming, and electronics.
42 in all bases: Binary = 101010 · Octal = 52 · Decimal = 42 · Hex = 2A. Each hex digit = 4 bits. FF hex = 11111111 binary = 255 decimal. Hex is used for web colors: #FF0000 = pure red.
Digit reference
Binary: 0–1
Octal: 0–7
Decimal: 0–9
Hex: 0–9, A–F (10–15)
Number Base Reference Table
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
| 2 | 10 | 2 | 2 |
| 3 | 11 | 3 | 3 |
| 4 | 100 | 4 | 4 |
| 7 | 111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 9 | 1001 | 11 | 9 |
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 31 | 11111 | 37 | 1F |
| 32 | 100000 | 40 | 20 |
| 63 | 111111 | 77 | 3F |
| 64 | 1000000 | 100 | 40 |
| 127 | 1111111 | 177 | 7F |
| 128 | 10000000 | 200 | 80 |
| 255 | 11111111 | 377 | FF |
Common Values in All Bases
| Decimal | Binary | Octal | Hex | Computing Context |
|---|---|---|---|---|
| 8 | 1000 | 10 | 8 | 1 byte needs 4 bits for each nibble |
| 16 | 10000 | 20 | 10 | 16 colours in early CGA graphics |
| 42 | 101010 | 52 | 2A | Answer to Life, the Universe, and Everything |
| 127 | 1111111 | 177 | 7F | Max value of a signed 8-bit integer |
| 128 | 10000000 | 200 | 80 | Min negative signed 8-bit integer |
| 255 | 11111111 | 377 | FF | Max unsigned 8-bit value; max RGB colour channel |
| 1024 | 10000000000 | 2000 | 400 | 1 KiB (kibibyte) = 1024 bytes |
| 65535 | 1111111111111111 | 177777 | FFFF | Max unsigned 16-bit value |
Number base notation by country / language
| Context | Binary prefix | Octal prefix | Hex prefix |
|---|---|---|---|
| C, C++, Java, JavaScript | 0b1010 | 0755 | 0xFF |
| Python 3 | 0b1010 | 0o755 | 0xFF |
| Assembly (NASM) | 1010b | 755o | 0FFh |
| CSS (web colors) | — | — | #FF5733 |
| Unix file permissions | — | 755 (bare) | — |
| UK / IEC standard | %1010 | — | &FF or $FF |
Hex Colours in Web Design
Hexadecimal is the universal standard for web colours. Each colour is represented as #RRGGBB — two hex digits each for red, green, and blue channels (0–255). Examples:
#FF0000= pure red (R=255, G=0, B=0)#00FF00= pure green#0000FF= pure blue#FFFFFF= white (all channels at max)#000000= black (all channels at zero)#0284C7= sky-600, the primary accent colour on this site
This standard is used identically by developers in the US, Europe, Japan, India, and everywhere else — hexadecimal is truly a global computing language.
Frequently Asked Questions
Why is hexadecimal used for colors?
RGB colors have three channels (red, green, blue), each with 256 possible values (0–255). Each channel is exactly one byte — representable as 2 hex digits (00 to FF). So #FF5733 means red=255, green=87, blue=51. This is more compact than decimal (rgb(255,87,51)) and more readable than 24-bit binary. The CSS hex color standard was introduced in HTML 2.0 (1995) and is now universal across all countries and browsers.
What are the 8-bit and 16-bit limits in decimal?
8-bit unsigned: 0–255 (2^8 - 1). 8-bit signed: -128 to 127. 16-bit unsigned: 0–65,535. 16-bit signed: -32,768 to 32,767. 32-bit unsigned: 0–4,294,967,295. 64-bit unsigned: 0–18,446,744,073,709,551,615. These limits appear across all computing — from C data types to network packet fields to image colour depths.
How does octal relate to Unix file permissions?
Unix permissions have three groups (owner, group, others), each with three bits (read=4, write=2, execute=1). Three bits fit in one octal digit. So chmod 755 means: owner=7 (rwx), group=5 (r-x), others=5 (r-x). This system originated with UNIX in 1969 and remains standard across Linux, macOS, BSD, and all POSIX systems worldwide.