Base Converter
Convert between binary, decimal, hex, and octal.
The Binary Converter lets you instantly convert numbers between four number bases: binary (base 2), decimal (base 10), hexadecimal (base 16), and octal (base 8). Type in any of the four fields and all others update automatically. Essential for computer science students, programmers working with memory addresses and bitwise operations, hardware engineers, and anyone learning digital electronics fundamentals. Includes a quick reference for common conversions and the relationship between bits, bytes, and hex values.
Base Converter
Formula
Examples
Convert Decimal 255 to All Bases
Convert decimal 255 to binary, hexadecimal, and octal.
โ Binary: 11111111 | Hex: FF | Octal: 377
CSS Color Code: #1A2B3C
Convert hex color values to decimal for RGB understanding.
โ Decimal: 26 | Binary: 00011010 | Octal: 32
Bitwise AND Operation Setup
Convert 170 and 85 to binary to perform bitwise AND.
โ 170 = 10101010 | 85 = 01010101 | AND = 00000000 = 0
Unix File Permission: chmod 755
Understand 755 in octal: owner=7, group=5, others=5.
โ Octal 7 = Binary 111 = Read(4) + Write(2) + Execute(1) = Full permissions
Tips
- โCSS hex colors: #FF0000 = rgb(255,0,0) red | #00FF00 = green | #0000FF = blue | #FFFFFF = white | #000000 = black.
- โA byte (8 bits) ranges from 0โ255 decimal, 00โFF hex, 00000000โ11111111 binary.
- โEach hex digit = exactly 4 binary bits โ making hex a compact representation of binary.
- โUnix permissions in octal: 4=read, 2=write, 1=execute. chmod 644 = owner read+write, group/others read only.
Frequently Asked Questions
How do I convert decimal to binary?
Repeatedly divide by 2 and record the remainders from bottom to top. Example: 13 รท 2 = 6 R 1, 6 รท 2 = 3 R 0, 3 รท 2 = 1 R 1, 1 รท 2 = 0 R 1 โ read remainders upward: 1101 in binary.
How do I convert binary to decimal?
Multiply each bit by 2 raised to its position power, then sum. Example: 1101 = (1ร2ยณ) + (1ร2ยฒ) + (0ร2ยน) + (1ร2โฐ) = 8 + 4 + 0 + 1 = 13.
What is hexadecimal used for in programming?
Hex is widely used in programming for: CSS color codes (#FF5733), memory addresses (0x1A2B3C4D), character encoding (ASCII/Unicode), bitmasking, and file format specifications. Each hex digit represents exactly 4 binary bits, making conversion between hex and binary straightforward.
How do I convert binary to hexadecimal?
Group binary digits in sets of 4 from right to left (padding with leading zeros if needed), then convert each group to its hex equivalent. Example: 11011010 โ 1101 1010 โ D A โ 0xDA.
What is octal and where is it used?
Octal (base 8) uses digits 0โ7. It was common in older computing systems and is still used in Unix/Linux file permissions. chmod 755 means owner=7 (rwx), group=5 (r-x), others=5 (r-x) in octal.
What is a byte and how many bits is it?
1 byte = 8 bits. A single byte can represent values from 0 (00000000 in binary) to 255 (11111111 = 0xFF in hex). This is why RGB colors range 0โ255 per channel and why single-byte ASCII codes go from 0โ127.