Converters

Number Base Converter

Convert a number between binary, octal, decimal, and hexadecimal. Runs entirely in your browser.

Binary

11111111

Octal

377

Decimal

255

Hexadecimal

FF

Advertisement

How it works

Type a number, choose the base it is written in, and the binary, octal, decimal and hexadecimal forms appear together. Hexadecimal letters can be upper or lower case; results are shown in upper case without prefixes such as 0x.

Example

255 in decimal is 11111111 in binary, 377 in octal and FF in hexadecimal. Going the other way, choose Hexadecimal and enter 1A to get 26 in decimal.

Size limit and prefixes

The tool uses JavaScript's ordinary number type, so integers above 9,007,199,254,740,991 (2^53 − 1) lose precision and the last digits of larger values, such as 64-bit IDs, will be wrong. A 0x prefix is accepted for hexadecimal only.

Frequently asked questions

Does this handle negative numbers?

Yes: the minus sign is kept and the digits are converted, so -255 shows as -11111111. It doesn't show two's complement, so it can't show how a negative number is stored in 8, 16 or 32 bits.

Why doesn't 12.7, or 1012 in binary, give an error?

The converter reads digits until it meets one that isn't valid in the chosen base and ignores the rest, so 12.7 is read as 12 and binary 1012 as 101. Enter whole numbers with valid digits only.

Related tools