All Number Converter

Type in one base. The other three fill as the same unsigned integer. Prefixes strip. Past 53 bits, the meter warns before you copy the decimal into JavaScript.

Load a known value

DECBase 10

BINBase 2

HEXBase 16

OCTBase 8

Type in any box. Prefixes 0x, 0b, 0o, spaces, and underscores are stripped.

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.

Four integers people type every week, written in all four bases
What you meantDecimalHexOctalBinary, grouped
One unsigned byte255FF3771111 1111
chmod 7554931ED7551 1110 1101
CSS #FF00AA16711850FF00AA776002521111 1111 0000 0000 1010 1010
4 KiB page size40961000100001 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.

Questions the four boxes leave open

Prefixes, chmod, the 53-bit JavaScript wall, and what this board will not convert.

Why did 0xFF fail in the decimal box?

Decimal digits are 0-9. The x is illegal there. Put FF in the hex box. Decimal fills 255. The 0x prefix is stripped only in hex, binary, or octal, where 0x, 0b, and 0o are known markers.

Does a leading zero make the number octal?

Only in the octal box. 0755 in decimal is seven hundred fifty-five. 0755 in octal is 493 decimal, the chmod 755 permission bits. Old JavaScript parseInt treated a leading zero as octal. ES5 stopped the octal guess. This page never uses parseInt.

Why does the meter warn at 53 bits if the hex still looks right?

JavaScript Number stores integers exactly up to 9007199254740991. Past the limit, a decimal literal rounds. Hex and binary stay exact as strings. The boxes here use BigInt, so they stay exact up to 256 bits. The warning is for the moment you paste the decimal into a script using Number.

Is my value sent to a server?

No. Conversion runs in this tab as JavaScript. Closing the tab drops the four fields. Nothing is uploaded.

Why will a negative number not convert?

The board reads unsigned integers. A minus sign is refused. 11111111 is 255 here, never -1. Two's complement needs a bit width you choose, and this page does not invent one.

Why is chmod 755 not 755 in decimal?

chmod writes octal. 755 octal is 493 decimal and 1ED hex. Load the chmod 755 chip to see all four at once. Typing 755 in the decimal box is a different integer.

How large a value does this accept?

Up to 256 bits. Past 256 bits the page refuses the paste rather than filling four giant strings. A 64-bit snowflake id is fine. A 4096-bit RSA modulus belongs in a bigint library on disk.

When should I use a one-direction converter instead?

When you are drilling one pair, such as binary to decimal with place values shown, or when you only want hex. Those pages exist next to this one. Keep this board when a slipped digit is cheaper to catch by reading four spellings together.