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.
See also: Unit Conversion Mistakes: Common Errors and Fixes, Understanding Compound Interest (APR, APY, Compounding Frequency), Loan Repayment Methods: Equal Payment vs. Equal Principal, Mortgage Total Cost: Beyond Principal and Interest · File Size Converter, Unit Converter, Age Calculator.
When this calculator helps most
Use for integer radix conversion and learning — not as a full signed-integer simulator unless the UI documents width.
What each input means
- Binary / Octal / Hex / Decimal — Digits valid per base (hex 0–9A–F, octal 0–7); leading zeros are cosmetic in value. (string per base)
Input mistakes to avoid
- •Use only valid digits per base (octal: 0–7).
- •Very large integers may exceed JS safe integer — watch rounding.
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
How to read your results
- →Same numeric value in different bases — conversion is exact for integers within safe precision.
- →Hex groups map to nibbles (4 bits); pad binary to multiples of 4 when hand-grouping to hex.
- →Signed integers (two’s complement) need explicit width — raw conversion here is unsigned-style unless noted in UI.
What this result means
All fields express the same mathematical value in different radices — semantics follow the UI’s signed/unsigned rules.
Common Pitfalls
- ⚠️Forgetting 0x prefix conventions vs plain hex entry.
- ⚠️Off-by-one bit width when masking or shifting in real code.
- ⚠️Floating-point binary — this tool is integer-oriented unless UI adds float modes.
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.
How to check your results
- ✓Round-trip: decimal → hex → decimal should match for in-range integers.
Warnings & Limitations
- ⚠️JavaScript safe integers end near 2^53 — huge bit patterns may need BigInt in real apps.
What this calculator does not tell you
- –Fixed bit-width two’s complement overflow behavior without explicit width.
- –Floating-point IEEE representations.
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.
Sources & References
Editorial & review note
We note safe integer limits and two’s complement caveats in interpretation text.
Related Calculators
File Size Converter
Convert bytes, KB, MB, GB, and TB.
Conversion ToolsUnit Converter
PopularConvert length, weight, temperature, area, and volume.
Conversion ToolsAge Calculator
PopularAccurately compute age from date of birth.
Date & TimeBMI Calculator
PopularBody mass index and healthy range.
Health BasicsCompound Interest
PopularFuture value and interest earned.
Finance & MoneyD-Day Countdown
PopularCalculate days remaining to a special date.
Date & TimeRelated guides
Unit Conversion Mistakes: Common Errors and Fixes
Avoid frequent unit mix-ups: metric vs imperial, area vs length squared, volume vs weight in recipes, and temperature conversion pitfalls.
Understanding Compound Interest (APR, APY, Compounding Frequency)
Learn how compound interest grows your money, how APR differs from APY, and why compounding frequency matters less than time and rate.
Loan Repayment Methods: Equal Payment vs. Equal Principal
Compare amortization methods, interest impact, and monthly payment profiles to pick a plan that fits your cash flow.
Mortgage Total Cost: Beyond Principal and Interest
Understand the full monthly cost of home ownership: taxes, insurance, PMI, and how they affect affordability.