Binary & Hex Converter
It converts a number between binary, decimal, hexadecimal, octal and any base from 2 to 36, showing the binary grouped into bytes.
Decimal value
255
Binary
11111111
Octal
377
Decimal
255
Hexadecimal
FF
Base 36
73
Bits needed
8
Binary, grouped into bytes
11111111
What it calculates
It converts a number between binary, decimal, hexadecimal, octal and any base from 2 to 36, showing the binary grouped into bytes.
Why it matters
Bases sit under everything in computing: hex for colors and memory addresses, binary for flags and permissions, octal for Unix file modes.
Who it's for
Developers, computer science students, and anyone reading a hex dump, a color code or a permission mask.
Formula
- Base
- How many distinct digits the system uses
- 0b / 0x
- Conventional prefixes for binary and hex
- Byte
- Eight binary digits
Worked example
255 in decimal
- 1255 = 11111111 in binary — eight ones
- 2255 = FF in hexadecimal
- 3255 = 377 in octal
One byte at its maximum value: 255, 0xFF, 0b11111111
How the binary & hex converter works
Every positional system works the same way — each digit is worth the base raised to its position. In base 10, 255 is 2×10² + 5×10¹ + 5×10⁰; in base 16 the same value is F×16¹ + F×16⁰. Hexadecimal earns its place in computing because one hex digit maps exactly onto four binary digits, so two hex digits are precisely one byte. That is why colors are written as six hex digits: three bytes, one each for red, green and blue.
Every positional system works the same way: each digit is worth the base raised to its position. In base 10, 255 is 2×10² + 5×10¹ + 5×10⁰; in base 16 the same value is F×16¹ + F×16⁰.
Hexadecimal earns its place in computing because one hex digit maps exactly onto four binary digits, so two hex digits are precisely one byte. That is why colors are six hex digits — three bytes, one each for red, green and blue.
Common mistakes
- Reading a hex value as decimal — 20 in hex is 32, not 20.
- Losing leading zeros, which matter when the width is fixed.
- Confusing octal with decimal in Unix permissions, where 755 is octal.
Tips and best practice
- One hex digit is exactly four bits, so hex and binary convert by inspection.
- 0x marks hex and 0b marks binary in most languages; both are accepted here.
- A byte holds 0–255, which is 0x00–0xFF — worth committing to memory.
Frequently asked questions
How do I convert binary to decimal?
Multiply each digit by two raised to its position and add them up. 11111111 is 128+64+32+16+8+4+2+1 = 255.
Why does computing use hexadecimal?
One hex digit maps exactly onto four binary digits, so two hex digits are precisely one byte. It is far more compact than binary and converts without arithmetic.
What is the largest value in one byte?
255, which is 0xFF in hex and 11111111 in binary — eight bits all set.
What base are Unix file permissions?
Octal, base 8. Each digit is three bits covering read, write and execute, which is why 755 means rwxr-xr-x.
What is the difference between 0x and 0b?
0x marks a hexadecimal literal and 0b a binary one, in most programming languages. Both prefixes are accepted and stripped here.
Related calculators
Methodology & trust
- Formula source
- Positional numeral system conversion, bases 2 through 36.
- Last updated
- 2026-07-28
- Privacy
- Every calculation runs in your browser. No inputs are sent to a server or stored.
- Accessibility
- Keyboard navigable, labeled inputs and WCAG AA color contrast.