Loading...
Convert numbers between binary, octal, decimal, and hexadecimal instantly. Free online base converter for programmers and students.
Binary (Base 2)
0b11111111Octal (Base 8)
0o377Decimal (Base 10)
255Hexadecimal (Base 16)
0xFFTry these:
Complete reference table for converting between binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16).
1010₂ → (1×2³) + (0×2²) + (1×2¹) + (0×2⁰) = 8 + 0 + 2 + 0 = 10₁₀
Multiply each digit by 2 raised to its position power (right to left, starting at 0). Sum all results.
13₁₀ → 13÷2=6 R1, 6÷2=3 R0, 3÷2=1 R1, 1÷2=0 R1 → read up: 1101₂
Divide by 2 repeatedly, record remainders. Read remainders from bottom to top.
0xFA → F=1111, A=1010 → 11111010₂
Replace each hex digit with its 4-bit binary equivalent. This is why hex is so popular — direct 1:4 mapping with binary.
11111111₂ → 1111 1111 → F F → FF₁₆ = 255₁₀
Group binary digits into chunks of 4 (from right). Convert each group to hex.
// Decimal to other bases
(255).toString(2); // "11111111" (binary)
(255).toString(8); // "377" (octal)
(255).toString(16); // "ff" (hex)
// Other bases to decimal
parseInt("11111111", 2); // 255
parseInt("377", 8); // 255
parseInt("FF", 16); // 255
// Literals
const bin = 0b11111111; // 255
const oct = 0o377; // 255
const hex = 0xFF; // 255# Decimal to other bases
bin(255) # '0b11111111'
oct(255) # '0o377'
hex(255) # '0xff'
# Other bases to decimal
int('11111111', 2) # 255
int('377', 8) # 255
int('FF', 16) # 255
# Literals
b = 0b11111111 # 255
o = 0o377 # 255
h = 0xFF # 255A base converter (number base converter) converts numbers between different numeral systems — binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16). These are the most commonly used bases in computer science and programming.
Binary uses only two digits: 0 and 1. It is the fundamental number system for all computers and digital electronics. Every piece of data in a computer — text, images, video — is ultimately stored as binary.
Hexadecimal uses digits 0-9 and letters A-F (where A=10, B=11, ... F=15). It is used in programming for memory addresses, color codes (#FF0000 = red), and representing binary data compactly. One hex digit = exactly 4 binary digits.
Octal uses digits 0-7. It is used in Unix/Linux file permissions (chmod 755), some programming languages, and legacy computing systems. One octal digit = exactly 3 binary digits.
Multiply each binary digit by its positional power of 2 and sum. For 1010: (1×8) + (0×4) + (1×2) + (0×1) = 8 + 0 + 2 + 0 = 10 in decimal.
Repeatedly divide by 2 and record remainders. 13 ÷ 2 = 6 R1, 6 ÷ 2 = 3 R0, 3 ÷ 2 = 1 R1, 1 ÷ 2 = 0 R1. Read remainders bottom-up: 1101.
Repeatedly divide by 16 and record remainders. 255 ÷ 16 = 15 R15. 15 ÷ 16 = 0 R15. Remainders: 15,15 → FF in hex. Or group binary into 4-bit chunks: 11111111 → 1111 1111 → F F → FF.
Replace each hex digit with its 4-bit binary equivalent. F = 1111, A = 1010, 0 = 0000. So 0xFA = 1111 1010 in binary. This is why hex is popular — easy conversion to/from binary.
0xFF is hexadecimal for 255 in decimal (11111111 in binary). The 0x prefix indicates hexadecimal notation in most programming languages (C, JavaScript, Python, Java). It represents the maximum value of a single byte (8 bits).
0b indicates binary notation in many languages (JavaScript, Python, C++). For example, 0b1010 = 10 in decimal. Similarly, 0o prefix means octal (0o17 = 15 decimal).
Computers use binary because digital circuits have two states: on (1) and off (0), represented by voltage levels. This makes binary the most reliable and efficient system for electronic computation, storage, and data transmission.
CSS hex colors use 6 hex digits: #RRGGBB. Each pair represents a color channel (0-255). #FF0000 = red (R=255, G=0, B=0). #00FF00 = green. #0000FF = blue. #FFFFFF = white. #000000 = black.
Disclaimer: This tool handles standard integer conversions between bases 2, 8, 10, and 16. For very large numbers, floating-point, or signed representations, verify with your programming environment.