Binary / Hex / Octal Converter

Base 2 (Binary) ยท Base 8 (Octal) ยท Base 10 (Decimal) ยท Base 16 (Hex)

Convert between binary, decimal, hexadecimal and octal number systems instantly. Type in any field โ€” all others update in real time. Essential for programmers, CS students and hardware engineers working with different number bases.

DEC
BIN
HEX
OCT
255 = 0xFF = 0b11111111 = 0o377 | 0x1A = 26 dec | chmod 755 = 111 101 101 bin

About Number Bases

A number base (or radix) determines how many unique digits a positional numeral system uses. Our everyday system uses base 10 (ten digits: 0โ€“9). Computing hardware operates in base 2 (binary) because electronic circuits have two states. Programmers use base 16 (hexadecimal) as a compact binary shorthand. Base 8 (octal) was popular in early computing and persists in Unix/Linux file permission notation. All four bases represent the same underlying value โ€” just in different notations.

๐Ÿ”Ÿ Decimal & Binary โ€” Base 10 and Base 2

Decimal (base 10) uses digits 0โ€“9. It is the system humans use naturally, likely because we have ten fingers. Binary (base 2) uses only 0 and 1. Every bit in a computer is a binary digit โ€” a transistor either passes current (1) or doesn't (0). All CPU instructions, memory addresses, file data and network packets are ultimately binary. An 8-bit byte can hold 256 values (0โ€“255). A 32-bit integer holds over 4 billion values. Converting between binary and decimal is the most fundamental skill in computer science.

๐Ÿ”ก Hexadecimal & Octal โ€” Base 16 and Base 8

Hexadecimal (base 16) uses digits 0โ€“9 plus letters Aโ€“F (A=10, B=11, C=12, D=13, E=14, F=15). Each hex digit maps to exactly 4 binary bits, making it a compact and human-readable binary representation. Colors in CSS (#RRGGBB), memory addresses (0x7FFF1234), and machine code are all expressed in hex. Octal (base 8) uses digits 0โ€“7, with each octal digit mapping to 3 binary bits. Linux file permissions use octal โ€” chmod 755 means owner: read/write/execute (7=111), group: read/execute (5=101), others: read/execute (5=101).

Why hex is preferred over octal in modern computing: Hex aligns perfectly with byte boundaries โ€” 2 hex digits = 1 byte = 8 bits. Octal doesn't divide evenly into bytes (3 bits per octal digit, but bytes are 8 bits), which made it awkward. Hex took over in the 1960sโ€“70s as byte-oriented architectures became standard. Octal survives mainly in Unix permissions and some legacy embedded systems.

Number Base Reference Table (0โ€“15)

The same values expressed in all four bases. Hex letters Aโ€“F map to decimal 10โ€“15.

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

Worked Examples

Decimal โ†’ Binary
13 รท 2 = 6 r1
6 รท 2 = 3 r0
3 รท 2 = 1 r1
1 รท 2 = 0 r1 โ†’ 1101
Read remainders bottom to top: 1101. Verify: 1ร—8 + 1ร—4 + 0ร—2 + 1ร—1 = 8+4+0+1 = 13 โœ“. This repeated-division method works for any decimal-to-binary conversion.
Binary โ†’ Hex
11111111
โ†’ 1111 | 1111
โ†’ F | F โ†’ FF
Group into nibbles (4 bits) from right. Each nibble becomes one hex digit. 1111 = F (8+4+2+1=15=F). So 11111111 = FF = 255. This is why hex is preferred โ€” 2 digits instead of 8.
Hex โ†’ Decimal
2F = (2 ร— 16ยน) + (15 ร— 16โฐ)
= 32 + 15 = 47
F = 15. Each position is a power of 16. 0x2F = 47. Similarly, 0xFF = (15ร—16) + 15 = 255. The 0x prefix is the programming convention for hex literals in C, Java, Python, JavaScript.
Unix File Permissions
chmod 755
7=111, 5=101, 5=101
โ†’ rwxr-xr-x
Each octal digit maps to 3 permission bits (read=4, write=2, execute=1). 7 = 4+2+1 = rwx. 5 = 4+0+1 = r-x. chmod 755 grants full access to the owner, read/execute to group and others โ€” the standard for executable scripts.

Who Uses a Binary / Hex Converter?

๐Ÿ‘จโ€๐Ÿ’ป
Software Developers
Inspect memory addresses, debug hex dumps, verify bitwise operations, decode error codes and understand CPU registers. Hex is the daily language of systems programming, reverse engineering and low-level debugging.
๐ŸŽ“
CS Students
Number base conversion is a core topic in every computer science curriculum. Binary arithmetic, two's complement, floating-point representation and digital logic all require fluency in converting between bases.
๐Ÿ”Œ
Hardware & Embedded Engineers
Microcontroller register maps, I2C/SPI addresses, ADC values and interrupt flag bits are all expressed in binary or hex. Converting between bases when reading datasheets and writing firmware is a constant need.
๐ŸŽจ
Web & UI Designers
CSS hex color codes (#RRGGBB) are hexadecimal. A designer working between hex colors and RGB values (0โ€“255) regularly needs to convert between decimal and hex for red, green and blue channel values.
๐Ÿง
Linux / Unix Administrators
File permissions (chmod), process IDs and network port numbers all appear in octal or hex in Unix documentation and system calls. Converting between octal permission masks and their binary/decimal equivalents is a daily sysadmin task.
๐Ÿ”
Cybersecurity Professionals
Shellcode, exploit offsets, hash values, encryption keys and network packet payloads are all represented in hex. Penetration testers and malware analysts constantly convert between hex and binary to understand what code is actually doing.

Mental Math Tips โ€” Number Bases

dec โ†’ bin

Memorise powers of 2: 1, 2, 4, 8, 16, 32, 64, 128, 256. To convert 200: 128 fits (1), remainder 72. 64 fits (1), remainder 8. 8 fits (1). So 200 = 11001000. The "greedy subtraction" method works faster than repeated division once you know the powers.

bin โ†’ hex

Group in 4s from the right and memorise the 16 nibble values (0000=0 through 1111=F). With practice this becomes instant: seeing 1010 immediately reads as A, 1111 as F, 0110 as 6. This is the fastest mental path between binary and hex โ€” no arithmetic needed.

hex โ†’ dec

For 2-digit hex (one byte): multiply the first digit by 16 and add the second. 0xA4 = 10ร—16 + 4 = 164. For single digit hex: A=10, B=11, C=12, D=13, E=14, F=15 โ€” just memorise these six. Everything else (0โ€“9) is the same as decimal.

Frequently Asked Questions โ€” Binary / Hex / Octal

Divide the decimal number by 2 repeatedly, recording the remainder each time (0 or 1). Read the remainders from bottom to top. Example: 13 รท 2 = 6 r1, 6 รท 2 = 3 r0, 3 รท 2 = 1 r1, 1 รท 2 = 0 r1. Reading remainders bottom to top: 1101. So decimal 13 = binary 1101.
Group the binary digits into sets of 4 from right to left, then convert each group to its hex equivalent: 0000=0, 0001=1 ... 1010=A, 1011=B, 1100=C, 1101=D, 1110=E, 1111=F. Example: binary 11111111 โ†’ groups 1111 and 1111 โ†’ F and F โ†’ hex FF.
255 in binary is 11111111 (eight 1-bits). In hexadecimal it is FF. In octal it is 377. The value 255 is significant in computing as the maximum value of an unsigned 8-bit byte, appearing in IP addresses (subnet mask 255.255.255.0) and RGB color values (max channel value).
Hexadecimal is a compact representation of binary. Each hex digit maps to exactly 4 binary bits, so an 8-bit byte is just 2 hex digits (e.g. 11111111 = FF). This makes hex far more readable than binary for memory addresses, color codes (#RRGGBB), CPU registers and machine code โ€” FF is much easier to read than 11111111.
Octal (base 8) uses digits 0โ€“7. Each octal digit maps to exactly 3 binary bits. It is used in Unix/Linux file permissions (e.g. chmod 755 means rwxr-xr-x), some legacy computer architectures, and certain embedded systems programming contexts. chmod 755 = octal 7(rwx) 5(r-x) 5(r-x).
The prefix 0x (zero followed by x) denotes a hexadecimal number in most programming languages (C, C++, Java, Python, JavaScript). For example, 0xFF = decimal 255, 0x1A = decimal 26. Similarly, 0b denotes binary (0b1101 = 13) and 0o or leading 0 denotes octal (0o17 = 15 in Python; 017 = 15 in C).
Multiply each hex digit by 16 raised to its position power (from right, starting at 0) and sum all results. A=10, B=11, C=12, D=13, E=14, F=15. Example: 2F = (2 ร— 16ยน) + (15 ร— 16โฐ) = 32 + 15 = 47. Or enter 2F in this converter's hex field and read the decimal result instantly.