Convert hex to decimal and binary
Convert hex to decimal, binary to decimal and back: the converter displays every number live in binary, octal, decimal and hexadecimal, with step-by-step calculations. For example, the hex number FF becomes 255 in decimal, 11111111 in binary and 377 in octal. Free, no sign-up required; conversion runs directly in your browser.
Built by Luca Stanek
- Binary, octal, decimal, hex
- With step-by-step calculations
- Two's complement up to 64 bits
- Runs in the browser
Writing code? Test it on your own VPS.
Sign
Bits
8 bits; click a bit to toggle it
Calculation steps from Hexadecimal to
From Hexadecimal to decimal: multiply each digit by its place value
- F × 161 = 15 × 16 = 240
- F × 160 = 15 × 1 = 15
- 240 + 15 = 255
Result in Decimal: 255(Base 10)
Example result
How the hex-to-decimal converter works
Enter a number in one base and get it in all the others. Here’s an example using FF: your result depends on your input.
Example · Input: FF (hexadecimal)
Input
- Hexadecimal
- FF
- Base 16, also written as 0xFF
Output
- Decimal
- 255
- 15 × 16 + 15 × 1
- Binary
- 1111 1111
- A full byte, all 8 bits set
- Octal
- 377
- 8-bit two's complement
- -1
- Read as a signed number, FF is −1
Features
More than a hex-to-decimal calculator
One tool for every number base, from computer science classes to debugging.
All number bases at once
Type in any field: decimal, binary, hexadecimal, octal, and a base of your choice from 2 to 36 update immediately, without choosing a conversion direction.
Step-by-step calculation
Place values, repeated division, and the shortcut using bit groups: see how the result is calculated and work through it yourself for homework or exams.
Two's complement with 8 to 64 bits
Negative numbers such as −1 appear as bit patterns like FF, FFFF, or FFFFFFFF. The calculator can also read a bit pattern as a signed number.
Clickable bits
Each bit has its own switch at its position. Click to set or clear it; all fields update immediately.
Arbitrarily large numbers
The converter calculates exactly with up to 1,024 digits, even far beyond 64 bits, with no rounding or scientific notation.
Prefixes and clear error messages
0x, 0b, 0o, # and spaces are supported. If a digit is invalid, the calculator shows its position; if a prefix is invalid, it points you to the correct field.
How it works
How to convert hex to decimal and between other number bases
Three steps from number to calculation, with no sign-up.
Step 1
Enter a number in any field
Enter the number in its original base: a hex number in the Hexadecimal field, a binary number in the Binary field. Prefixes such as 0x, 0b and 0o, and spaces between digits, are allowed.
Step 2
View results in every base
All other fields update instantly: decimal, binary, hexadecimal, octal and a base of your choice. For negative numbers, choose two’s complement with 8 to 64 bits.
Step 3
Follow and copy the calculation steps
Choose the target base under Calculation steps and follow each step. Copy a value with one click or share a link containing your number.
Calculate by hand
Converting number bases: the methods
Six methods to help you convert any number without a calculator. All examples were calculated with the converter above.
Convert hex to decimal
Each position is a power of 16. Multiply each digit by its place value and add the results. A through F represent 10 through 15.
2 × 161 = 32
A × 160 = 10
2A = 32 + 10 = 42
Convert binary to decimal
Each position is a power of 2. Add the place values of all the 1s, counting from the right: 1, 2, 4, 8, 16, 32, and so on.
1×25 + 0×24 + 1×23 + 0×22 + 1×21 + 0×20
101010 = 32 + 8 + 2 = 42
Convert decimal to binary
Keep dividing the number by 2 and write down each remainder. Read the remainders from bottom to top to get the binary number.
42 ÷ 2 = 21 remainder 0
21 ÷ 2 = 10 remainder 1
10 ÷ 2 = 5 remainder 0
5 ÷ 2 = 2 remainder 1
2 ÷ 2 = 1 remainder 0
1 ÷ 2 = 0 remainder 1
42 = 101010
Convert decimal to hex
Use the same remainder method with 16: divide by 16, write each remainder as a hex digit (10 = A through 15 = F), then read the remainders from bottom to top.
2026 ÷ 16 = 126 remainder 10 (A)
126 ÷ 16 = 7 remainder 14 (E)
7 ÷ 16 = 0 remainder 7
2026 = 7EA
Binary to hex and hex to binary
Four bits make exactly one hex digit. Split the binary number into groups of four from the right and write the corresponding digit for each group. For octal, use groups of three.
0010 → 2
1010 → A
101010 = 2A
Negative numbers in two's complement
Write the absolute value using a fixed bit width, invert all the bits, and add 1. If the highest bit is 1, the number is negative.
Magnitude 42: 00101010
Inverted: 11010101
Plus 1: 11010110 = D6
Conversion table
Table: decimal, binary, hex, and octal from 0 to 31
The first 32 numbers in all four bases, plus the limits you’ll often encounter when programming.
| Decimal | Binary | Hexadecimal | Octal |
|---|---|---|---|
| 0 | 0000 0000 | 00 | 0 |
| 1 | 0000 0001 | 01 | 1 |
| 2 | 0000 0010 | 02 | 2 |
| 3 | 0000 0011 | 03 | 3 |
| 4 | 0000 0100 | 04 | 4 |
| 5 | 0000 0101 | 05 | 5 |
| 6 | 0000 0110 | 06 | 6 |
| 7 | 0000 0111 | 07 | 7 |
| 8 | 0000 1000 | 08 | 10 |
| 9 | 0000 1001 | 09 | 11 |
| 10 | 0000 1010 | 0A | 12 |
| 11 | 0000 1011 | 0B | 13 |
| 12 | 0000 1100 | 0C | 14 |
| 13 | 0000 1101 | 0D | 15 |
| 14 | 0000 1110 | 0E | 16 |
| 15 | 0000 1111 | 0F | 17 |
| Decimal | Binary | Hexadecimal | Octal |
|---|---|---|---|
| 16 | 0001 0000 | 10 | 20 |
| 17 | 0001 0001 | 11 | 21 |
| 18 | 0001 0010 | 12 | 22 |
| 19 | 0001 0011 | 13 | 23 |
| 20 | 0001 0100 | 14 | 24 |
| 21 | 0001 0101 | 15 | 25 |
| 22 | 0001 0110 | 16 | 26 |
| 23 | 0001 0111 | 17 | 27 |
| 24 | 0001 1000 | 18 | 30 |
| 25 | 0001 1001 | 19 | 31 |
| 26 | 0001 1010 | 1A | 32 |
| 27 | 0001 1011 | 1B | 33 |
| 28 | 0001 1100 | 1C | 34 |
| 29 | 0001 1101 | 1D | 35 |
| 30 | 0001 1110 | 1E | 36 |
| 31 | 0001 1111 | 1F | 37 |
Important limits
| Decimal | Hexadecimal | Meaning |
|---|---|---|
| 127 | 7F | Largest signed 8-bit number |
| 255 | FF | Largest number in one byte |
| 1024 | 400 | 2 to the power of 10, one kilobyte in binary |
| 32767 | 7FFF | Largest signed 16-bit number |
| 65535 | FFFF | Largest 16-bit number, also the highest port number |
| 2147483647 | 7FFFFFFF | Largest signed 32-bit number |
| 4294967295 | FFFFFFFF | Largest 32-bit number, also an IPv4 address |
| 9223372036854775807 | 7FFFFFFFFFFFFFFF | Largest signed 64-bit number |
Practical examples
Where you’ll encounter hex, binary and octal
Three common situations where you need to convert between number bases, with examples from the converter.
Hex to decimal in code
In Python, int("ff", 16) converts a hex number to decimal; in JavaScript, parseInt("ff", 16) does the same. Both return 255 for ff. The converter above shows you the steps.
int("ff", 16) = 255
parseInt("ff", 16) = 255
Hex colour codes
A colour code such as #FF8800 consists of three hex pairs for red, green and blue, each ranging from 00 to FF, or 0 to 255. Enter a pair in the Hexadecimal field to see its decimal value.
FF = 255
88 = 136
00 = 0
Octal in file permissions
Linux file permissions such as 755 are octal numbers: each digit represents exactly three bits. Enter 755 in the Octal field to see the bits and decimal value.
7 → 111
5 → 101
5 → 101
755 = 493
Explore more
More tools
CHMOD Calculator
Build Unix/Linux file permissions using checkboxes to get an octal value and symbolic notation, or decode them in reverse — including setuid/setgid/the sticky bit and a ready-to-copy chmod command.
Built by Justin Schuessler
Base64 Encoder/Decoder
Encode and decode text in Base64, including a URL-safe variant and clear error messages, entirely in your browser.
Built by Jakub Martyniak
Color Picker
Convert colors between HEX, RGB, HSL, HSV, and CMYK in real time, find the closest CSS named color, and check WCAG contrast against black and white—all in your browser.
Built by Justin Schuessler
Convert Roman numerals (Roman Numeral Converter)
Convert numbers to Roman numerals and back, write dates, and calculate with Roman numerals using a chart up to 3999. Runs entirely in your browser.
Built by Rugile Rutkauskaite
Data Size Calculator
Convert bytes, GB and TB (decimal and binary), and calculate download time, required bandwidth and monthly traffic, for example for a server's traffic allowance.
Built by Eric Mager
Binary Translator
Convert text to binary, hex, decimal (ASCII), and octal and back: UTF-8 support, including umlauts and emoji, automatic detection, and an ASCII table. Runs entirely in your browser.
Built by Dimitri Heissler
FAQ
Frequently asked questions about the hex to decimal converter
Quick answers about hex, binary, decimal, octal, and two's complement.
Enter a number in one base and immediately get it in all the others. The hex number FF becomes 255 in decimal, 11111111 in binary, and 377 in octal. The calculator also shows the calculation and, if the number fits in 64 bits, every individual bit.
Each position in a hex number is a power of 16, counting from the right: 1, 16, 256, 4096. Multiply each digit by its place value and add the results; the letters A through F represent 10 through 15. This makes 2A equal to 2 × 16 + 10 × 1 = 42.
Add the place values of all the 1s. Counting from the right, they are 1, 2, 4, 8, 16, and so on. So the binary number 1101 is 8 + 4 + 1 = 13. Enter the binary number in the Binary field above to see each position in the calculation.
Keep dividing the number by 2 and note each remainder until you reach 0. Read the remainders from bottom to top to get the binary number: 42 becomes 101010. Converting decimal to octal works the same way with 8, and decimal to hex with 16.
Use repeated division by 16. Each remainder from 10 to 15 becomes a letter from A to F. Dividing 2026 by 16 gives 126 remainder 10 (A); 126 divided by 16 gives 7 remainder 14 (E); 7 divided by 16 gives 0 remainder 7. Reading from bottom to top, 2026 is 7EA.
No need to go through decimal: four bits make exactly one hex digit. Split the binary number into groups of four from the right and replace each group with its digit: 1010 1111 becomes AF. To go the other way, write each hex digit as four bits. The same works for octal using groups of three.
This is how computers store negative integers. With a fixed bit width, invert all the bits of the absolute value and add 1. With 8 bits, −1 becomes 11111111, or FF, and −128 becomes 10000000. Select two's complement and the bit width above to see the bit pattern and calculation.
Unsigned, FFFFFFFF is 4294967295, the largest 32-bit number. In 32-bit two’s complement, the same bit pattern represents -1. Select Two’s complement and 32 bits above, then enter FFFFFFFF in the Hexadecimal field: the Decimal field will show -1, while the bits will also show the unsigned value.
Integers in any base from 2 to 36, exact up to 1024 digits—even far beyond 64 bits. The prefixes 0x, 0b and 0o, as well as # for hex, are recognised. Spaces, underscores and apostrophes between digits are ignored. The converter doesn’t support fractional numbers; entering a comma or period in the Decimal field displays a notice.
The Binary Translator converts text—letters and characters—to binary code and back. This converter converts numbers between number bases: the number 65 becomes 1000001. To write a word in binary, use the Binary Translator. To convert a number, you're in the right place.
Any more questions?
Contact SupportYour code needs a server that's always running
A ZAP-Hosting VPS reliably gets your application, bot, or API online, with root access and full control.
No setup. No risk. Online in seconds.
Looking for more tools? View all developer tools
