Twelve converters on this site take one pair of bases. Binary to decimal. Hex to octal. Each of those pages is honest about a single direction. They also hide a mismatch. You convert 255 to FF, copy the hex, then later drop a digit and only notice when a CSS color turns teal.
This board keeps four spellings of one unsigned integer in the same view.
Type in any box. The other three fill. A prefix such as 0x, 0b, or 0o is stripped before the digits are read. Spaces and underscores go the same way, because people paste from dumps.
A number is a count. Binary, octal, decimal, hexadecimal are four alphabets for writing the count. They are not four different values.
I still watch people paste 0xFF into the decimal box, then claim the converter is broken. The 0x is a label. The digits are FF. Put FF in hex. Decimal fills 255.
| What you meant | Decimal | Hex | Octal | Binary, grouped |
|---|---|---|---|---|
| One unsigned byte | 255 | FF | 377 | 1111 1111 |
chmod 755 | 493 | 1ED | 755 | 1 1110 1101 |
CSS #FF00AA | 16711850 | FF00AA | 77600252 | 1111 1111 0000 0000 1010 1010 |
| 4 KiB page size | 4096 | 1000 | 10000 | 1 0000 0000 0000 |
Load any row with the chips above the boxes. Read the four spellings before you copy one of them into a config file.
0x is a comment you type for humans
C, C++, Java, JavaScript, Python, Rust, and Go all accept 0x before hex digits. 0b before binary arrived later. 0o before octal is the one people skip, because Unix wrote 0755 with a leading zero decades before 0o existed.
On this board the prefix is optional and ignored. FF, 0xFF, and 0Xff are the same hex. 1010, 0b1010, and 0B1010 are the same binary.
755, 0o755, and 0755 are the same octal only when you type them in the octal box. Drop 0755 in decimal and you get seven hundred fifty-five, not the permission bits.
Old JavaScript parseInt used to treat a leading zero as octal. ES5 stopped the octal guess. parseInt('0755') is 755 now. parseInt('0755', 8) is 493. The base argument is the only safe way to call parseInt.
This page never uses parseInt. Conversion runs on BigInt so a 64-bit id does not round in silence.
Group binary in fours or you will drop a bit
A raw binary string of 24 ones is unreadable. Group from the right in fours. Each group is one hex digit. Hex won memory dumps, MAC addresses, and CSS colors for this reason.
1111 is F. 0000 is 0. 1010 is A. Read the nibble map under the boxes after you type. If the groups do not line up with the hex digits, you dropped a bit or added a space in the wrong place.
Need the place-value arithmetic written out digit by digit? Open the binary to decimal converter. This board does not print powers of two. The board prints the four spellings so a mismatch is visible.
A single hex digit is four bits. Two hex digits are a byte. FF is 255, the largest unsigned 8-bit value. FFFF is 65535, the 16-bit ceiling. Those two numbers show up in every protocol header I have ever read. Going the other way, from hex digits back to bits, is what the hex to binary page does as a one-direction drill.
If the four boxes disagree after a paste, leave Copy alone. The red line under a box names the illegal digit. Fix the marked box. The others catch up.
chmod 755 is octal even when nobody writes 0o
Unix file modes are three octal digits: owner, group, other. Each digit is three bits, rwx. 7 is 111, full access. 5 is 101, read and execute. 755 is rwxr-xr-x.
People type 755 into a decimal converter, get 2F3 in hex, then wonder why chmod 2F3 does nothing useful. 755 octal is 493 decimal, 1ED hex. The octal box on this board is the one chmod talks to.
Need only octal to decimal? The octal to decimal page exists for a one-way check. Keep this board when you also want the binary permission bits in the same glance.
A fourth octal digit appears on setuid, setgid, and sticky bits. 4755 is the setuid variant of 755. Type 4755 in octal here to see 9ED hex and 100111101101 binary.
Memory addresses, color values, and byte dumps belong in hex. The decimal to hex converter is the pairwise version of the hex column. Use the pairwise page when you are drilling one direction. Use this one when you need the octal and binary sitting next to the hex so a slipped digit is obvious.
Past 53 bits, the decimal you copy into JavaScript is a lie
JavaScript Number stores integers exactly up to 9007199254740991, two to the fifty-three minus one. Past the limit, the trailing bits of a decimal literal round. Hex of a 64-bit id still looks fine in a string. Drop the same value into a Number and the last bits flip.
This board converts with BigInt, so the four boxes stay exact up to 256 bits. The meter under the boxes turns amber when the integer no longer fits in Number.MAX_SAFE_INTEGER. Copy the hex or the binary into a script. Leave the decimal alone unless the language has a bigint type.
IPv6 pieces, UUIDs, and 64-bit database keys hit this wall every day. A snowflake id from Twitter, Discord, or a similar service is 64 bits. Paste one here. The warning is the point.
Ceiling is 256 bits. A value past 256 bits belongs in a bigint library on disk, not in four text inputs in a tab.
Accepted, stripped, refused
- Accepted
- Unsigned integers. Digits 0-1 in binary, 0-7 in octal, 0-9 in decimal, 0-9 A-F in hex. Optional prefixes
0b,0o,0x. Spaces and underscores inside a value. - Stripped
- The prefix tokens, whitespace, grouping underscores. A hash in front of a CSS color is stripped on the hex box the same way.
- Refused
- A minus sign. A decimal point. Scientific notation. ASCII text. A digit illegal in the chosen base. Two's complement bit patterns read as signed. A string longer than 256 bits.
Two's complement lives on a different page
-1 in eight-bit two's complement is 11111111. Unsigned, those same bits are 255. This board always reads unsigned. A leading minus is an error, not a sign bit.
If you need the bit pattern of a negative integer, write the width down, or pick a language printing two's complement for you. Flipping the unsigned boxes here will not invent a sign.
Byte order is a different question again. 0A0B0C0D as little-endian memory is 0D0C0B0A. Reversing bytes is not converting bases. Open reverse hex for byte order. Bitwise masks belong on the XOR calculator, not in a base converter.
A CSS color with a hash in front is hex. Strip the hash, then type the six digits in the hex box. #FF00AA is FF00AA, decimal 16711850. The hash is CSS syntax. The digits are the number.
