Useful Utilities

Binary Hex Decimal Converter

Convert any integer between binary, octal, decimal and hexadecimal with 0b, 0o and 0x prefixes and digit grouping, reporting bit length and two's-complement notes for negatives.

Fill in the values and calculate

Value*Digits in the base below; a leading minus is a negative, spaces and underscores inside digit groups are ignored
Base of inputDefault Decimal (base 10)

The form sends itself back to this page — results print below, computed on the server.

No results yet: fill the form above and press Calculate.

About Binary Hex Decimal Converter

The value is parsed digit by digit with BigInt in the base you select, so the width of the number is bounded only by memory, and a leading minus sign is accepted.

Every form is the same integer written in base 2, 8, 10 and 16 with the 0b, 0o and 0x prefixes languages use for literals. Digits are grouped cosmetically from the right: binary in nibbles, hexadecimal in two-byte blocks, octal in three digits and decimal with thousands commas; grouping never changes the value.

Bit length counts the magnitude's bits, i.e. the unsigned storage it needs. Negatives are explained the way computers actually store them: flip every bit of the magnitude and add one, which is two's complement, and the leftmost 1 becomes the sign bit.

Questions about Binary Hex Decimal Converter

How do I enter a negative number?

Put a minus sign in front. The notes then show its two's-complement form, which is how signed integers live in memory.

Can I paste grouped numbers back in?

Yes: spaces, underscores and apostrophes between digit groups are ignored on input.

Why these four bases only?

They are exactly the bases with standard literal prefixes in code (0b, 0o, 0x), and every other base conversion in this site's family.

What does bit length mean here?

The number of bits needed to write the absolute value as an unsigned integer. Signed storage adds one for the sign bit.

Does it handle huge numbers?

Yes, arbitrary precision: anything from a byte to a 1024-bit hash converts exactly.

Bookmark and homescreen