Hexadecimal Converter
Type in any field — hex, decimal, binary, octal or another base — and every other field follows, exactly.
Type in any field; every base follows.
Widths apply to whole numbers.
Repeats forever:
As signed 8-bit: −1
Repeats forever:
Unsigned:
Repeats forever:
Repeats forever:
Any base, 2–36
Method: Sum of powers of 16
| Digit | Value | Weight | Product |
|---|---|---|---|
| F | 15 | × 161 | 240 |
| F | 15 | × 160 | 15 |
Add the products: 255.
What is hexadecimal?
Hexadecimal is base 16, written with 0–9 and A–F for ten to fifteen. Type a value into any field of this hex converter — hex, decimal, binary, octal or any base from 2 to 36 — and the others update at once, exact at any length, with two’s complement for negatives and the hand method on request.
Programmers reach for hex because one hex digit is exactly four bits. A byte is always two digits, from 00 to FF, and a 32-bit word is always eight, so a memory address, a color like #1E90FF or a register dump stays short and still lines up with the bits underneath. Decimal hides that structure; binary shows it but runs four times as long.
How to convert hex, decimal, binary and octal
Type the number into the field for its base. There is no From and To to set before you start, and no Convert button. The field you type in becomes the source and the rest become answers. Here the value went in as decimal, so the accent dot sits on DEC and hex is the one to copy.
Widths apply to whole numbers.
Repeats forever:
Repeats forever:
Unsigned:
Repeats forever:
Repeats forever:
Any base, 2–36
Method: Repeated division by 16
| Divide | Quotient | Remainder | Digit |
|---|---|---|---|
| 2024 ÷ 16 | 126 | 8 | 8 |
| 126 ÷ 16 | 7 | 14 | E |
| 7 ÷ 16 | 0 | 7 | 7 |
Read the remainders from the bottom up: 7E8.
Pasting hex with 0x, # or h
Values come with the habits of wherever they were copied from: 0x from C, # from CSS, a trailing h from an assembly listing, underscores from a Rust literal, spaces from a hex dump. The panel removes them and says exactly what it removed, so nothing is reinterpreted behind your back.
Widths apply to whole numbers.
Repeats forever:
Read as hex: ignored 2 separators, removed the # prefix, removed the h suffix.
Repeats forever:
Unsigned:
Repeats forever:
Repeats forever:
Any base, 2–36
Method: Sum of powers of 16
| Digit | Value | Weight | Product |
|---|---|---|---|
| 1 | 1 | × 165 | 1 048 576 |
| A | 10 | × 164 | 655 360 |
| 2 | 2 | × 163 | 8192 |
| B | 11 | × 162 | 2816 |
| 3 | 3 | × 161 | 48 |
| C | 12 | × 160 | 12 |
Add the products: 1 715 004.
Converting large numbers without rounding
Ordinary JavaScript numbers stop being exact above 253, which is why many converters quietly round a 64-bit ID. This one does integer arithmetic on arbitrary-length values, so 2128 − 1 comes out as thirty-two F’s and not a number ending in zeros.
Widths apply to whole numbers.
Repeats forever:
Repeats forever:
Unsigned:
Repeats forever:
Repeats forever:
Any base, 2–36
Method: Repeated division by 16
| Divide | Quotient | Remainder | Digit |
|---|---|---|---|
| 340 282 366 920 938 463 463 374 607 431 768 211 455 ÷ 16 | 21 267 647 932 558 653 966 460 912 964 485 513 215 | 15 | F |
| 21 267 647 932 558 653 966 460 912 964 485 513 215 ÷ 16 | 1 329 227 995 784 915 872 903 807 060 280 344 575 | 15 | F |
| 1 329 227 995 784 915 872 903 807 060 280 344 575 ÷ 16 | 83 076 749 736 557 242 056 487 941 267 521 535 | 15 | F |
| 83 076 749 736 557 242 056 487 941 267 521 535 ÷ 16 | 5 192 296 858 534 827 628 530 496 329 220 095 | 15 | F |
| 5 192 296 858 534 827 628 530 496 329 220 095 ÷ 16 | 324 518 553 658 426 726 783 156 020 576 255 | 15 | F |
| 324 518 553 658 426 726 783 156 020 576 255 ÷ 16 | 20 282 409 603 651 670 423 947 251 286 015 | 15 | F |
| 20 282 409 603 651 670 423 947 251 286 015 ÷ 16 | 1 267 650 600 228 229 401 496 703 205 375 | 15 | F |
| 1 267 650 600 228 229 401 496 703 205 375 ÷ 16 | 79 228 162 514 264 337 593 543 950 335 | 15 | F |
| 79 228 162 514 264 337 593 543 950 335 ÷ 16 | 4 951 760 157 141 521 099 596 496 895 | 15 | F |
| 4 951 760 157 141 521 099 596 496 895 ÷ 16 | 309 485 009 821 345 068 724 781 055 | 15 | F |
| 309 485 009 821 345 068 724 781 055 ÷ 16 | 19 342 813 113 834 066 795 298 815 | 15 | F |
| 19 342 813 113 834 066 795 298 815 ÷ 16 | 1 208 925 819 614 629 174 706 175 | 15 | F |
| 1 208 925 819 614 629 174 706 175 ÷ 16 | 75 557 863 725 914 323 419 135 | 15 | F |
| 75 557 863 725 914 323 419 135 ÷ 16 | 4 722 366 482 869 645 213 695 | 15 | F |
| 4 722 366 482 869 645 213 695 ÷ 16 | 295 147 905 179 352 825 855 | 15 | F |
| 295 147 905 179 352 825 855 ÷ 16 | 18 446 744 073 709 551 615 | 15 | F |
| 18 446 744 073 709 551 615 ÷ 16 | 1 152 921 504 606 846 975 | 15 | F |
| 1 152 921 504 606 846 975 ÷ 16 | 72 057 594 037 927 935 | 15 | F |
| 72 057 594 037 927 935 ÷ 16 | 4 503 599 627 370 495 | 15 | F |
| 4 503 599 627 370 495 ÷ 16 | 281 474 976 710 655 | 15 | F |
| 281 474 976 710 655 ÷ 16 | 17 592 186 044 415 | 15 | F |
| 17 592 186 044 415 ÷ 16 | 1 099 511 627 775 | 15 | F |
| 1 099 511 627 775 ÷ 16 | 68 719 476 735 | 15 | F |
| 68 719 476 735 ÷ 16 | 4 294 967 295 | 15 | F |
| 4 294 967 295 ÷ 16 | 268 435 455 | 15 | F |
| 268 435 455 ÷ 16 | 16 777 215 | 15 | F |
| 16 777 215 ÷ 16 | 1 048 575 | 15 | F |
| 1 048 575 ÷ 16 | 65 535 | 15 | F |
| 65 535 ÷ 16 | 4095 | 15 | F |
| 4095 ÷ 16 | 255 | 15 | F |
| 255 ÷ 16 | 15 | 15 | F |
| 15 ÷ 16 | 0 | 15 | F |
Read the remainders from the bottom up: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.
Negative hex numbers and two’s complement
The bits FFFFFFFF mean 4,294,967,295 or −1 depending on how many bits you assume. Pick a width and the panel reads the pattern in two’s complement: decimal shows the signed value, and the unsigned reading stays one line below it. With Any selected, a value whose top bit is set gets a suggestion, never a silent reinterpretation.
Widths apply to whole numbers.
Repeats forever:
Read as hex: ignored 1 separator, removed the 0x prefix.
Repeats forever:
Unsigned: 4 294 967 295
Repeats forever:
Repeats forever:
Any base, 2–36
Method: Sum of powers of 16
| Digit | Value | Weight | Product |
|---|---|---|---|
| F | 15 | × 167 | 4 026 531 840 |
| F | 15 | × 166 | 251 658 240 |
| F | 15 | × 165 | 15 728 640 |
| F | 15 | × 164 | 983 040 |
| F | 15 | × 163 | 61 440 |
| F | 15 | × 162 | 3840 |
| F | 15 | × 161 | 240 |
| F | 15 | × 160 | 15 |
Add the products: 4 294 967 295.
As a signed 32-bit value the top bit is set, so subtract 232: 4 294 967 295 − 4 294 967 296 = −1.
Converting fractions between bases
One tenth has no finite form in base 16; it is 0.1999… forever. The panel finds the repeating block and puts it in brackets, which you can paste back in. An expansion that would run past 64 digits is cut there and labelled as truncated instead of being rounded.
Widths apply to whole numbers.
Repeats forever: 0.19
Repeats forever:
Unsigned:
Repeats forever: 0.00011
Repeats forever: 0.06314
Any base, 2–36
Method: Repeated division by 16
The whole part is 0, so the hex number starts 0.
| Multiply | Product | Digit |
|---|---|---|
| 0.1 × 16 | 1.6 | 1 |
| 0.6 × 16 | 9.6 | 9 |
The row 0.6 comes back, so the digits from there repeat forever.
Seeing the conversion steps
Under every panel there is a working for the current value: each digit times its power of 16, each division with its remainder, each nibble written out. It stays closed until you ask, and it follows the field you typed in.
Widths apply to whole numbers.
Repeats forever:
Repeats forever:
Unsigned:
Repeats forever:
Repeats forever:
Any base, 2–36
Method: Sum of powers of 16
| Digit | Value | Weight | Product |
|---|---|---|---|
| 2 | 2 | × 163 | 8192 |
| A | 10 | × 162 | 2560 |
| F | 15 | × 161 | 240 |
| 3 | 3 | × 160 | 3 |
Add the products: 10 995.
One page per conversion
- Hex to decimalPowers of 16, and the signed reading of 7FFFFFFF and FFFFFFFF
- Decimal to hexDivision by 16, fractions and negative numbers
- Hex to binaryThe sixteen nibbles and when to keep leading zeros
- Binary to hexGrouping by four from the right, binary fractions
- Hex to octalThrough binary, with Unix permission bits
- Octal to hexOctal literals in C and Python, escape sequences
- Hex to textDecode bytes as ASCII or UTF-8, with bad bytes located
- Text to hexEncode text as bytes in five output formats
- Hex calculatorAdd, subtract and bitwise logic with carry and overflow flags
- Hexadecimal chartEvery byte 0–255 in five columns, ready to print
How positional bases work
Every base on this page is positional: a digit’s worth depends on where it stands. In decimal the places are ones, tens, hundreds; in hex they are ones, sixteens, two-hundred-fifty-sixes; in binary ones, twos, fours, eights. A number is the sum of each digit times its place value, and that is all any conversion has to preserve.
Going from another base into decimal means adding up those products. Going out of decimal means the reverse: divide by the new base again and again, and the remainders are the digits, last one first. Between binary, octal and hex there is a shortcut because 8 and 16 are powers of 2. Each octal digit is three bits and each hex digit four, so you can swap digits for bit groups without any arithmetic.
Bases above ten borrow letters. Hex uses A–F for ten to fifteen, and base 36 runs all the way to Z, which is why short links and some IDs are written in it. Letters are read the same in upper or lower case.
Questions people ask
How do you convert hexadecimal?
Each hex digit is worth 16 times the digit to its right. To get decimal, multiply every digit by its power of 16 and add the products; to go the other way, divide by 16 repeatedly and read the remainders backwards. For binary, swap each hex digit for its four bits.
What does FF mean in hex?
FF is the largest two-digit hex value: 15 × 16 + 15 = 255, or 11111111 in binary. It is the maximum value of one byte, which is why it marks a full color channel in #FF0000 and a full byte mask in code.
What does B mean in hex?
B stands for 11. Hex uses the letters A to F for the values 10 to 15, so B is 11 and B0 is 11 × 16 = 176.
Is hexadecimal the same as hex?
Yes. Hex is short for hexadecimal, the base-16 number system, so there is nothing to convert. Markers such as 0x, # or a trailing h only label a number as hex; the converter removes them and tells you it did.
How are negative numbers written in hex?
Computers store them in two’s complement at a fixed width. At 8 bits, −1 is FF and −128 is 80; at 32 bits, −1 is FFFFFFFF. Choose a width and the converter shows the bit pattern in hex, binary and octal and the signed value in decimal.
Can the converter handle fractions?
Yes. Repeating fractions show the repeating digits in brackets, so 0.1 in decimal is 0.1(9) in hex. An expansion longer than 64 digits is cut off and labelled as truncated, never silently rounded.
Last updated