99tools

Number Base Converter

runs in your browser

Convert between binary, octal, decimal, hexadecimal and any base up to 36, with exact arithmetic for values too large for a normal number.

Read as

In every common base

  • Binary1111 1111
  • Octal377
  • Decimal255
  • Hexadecimalff

About this number

Bits needed
8
Bytes
1
Fits in
unsigned 8 bit
As bytes
255 B
As a character
ÿ (U+00FF)

Arithmetic uses arbitrary precision, so a 64 bit value stays exact rather than losing its last digits.

about this tool

Every base at once

Type a number in any base from 2 to 36 and read it in all the common ones together: binary, octal, decimal and hexadecimal, plus whichever custom radix you need. Prefixes are understood on input, so 0x1f, 0b1011 and 0o755 are recognised without telling the tool which base you meant.

Arbitrary precision

Conversion uses big integers, so precision does not quietly disappear on large values. This matters more than it sounds: JavaScript's numbers lose exactness above 2^53, which is well within the range of a 64-bit database ID, a Discord snowflake or a hardware register dump. A converter built on ordinary numbers returns a subtly wrong answer for those, with no warning.

Where each base turns up

Hexadecimal is everywhere two hex digits map neatly to one byte: colours, memory addresses, hashes, MAC addresses, encoding tables.

Binary is for reading a bitmask, checking which flags are set, or working out a subnet.

Octal survives almost entirely for Unix file permissions. 0755 is three groups of three bits — read, write, execute for owner, group and other — which is why permissions are quoted in octal and nothing else.

Base 36 uses every digit and letter, which makes it the most compact case-insensitive way to write a number in plain text. It shows up in short IDs and URL slugs.

For hex that is specifically a colour, the colour converter reads it back as RGB and HSL.

Grouping

Long binary strings are unreadable in one run, so digits can be grouped: fours for a nibble boundary, eights for a byte. 11010110 reads as 1101 0110 without effort, and the hex nibbles line up visually with the binary groups.

Negative numbers, and what this tool does not do

Negative values are shown with a minus sign, which is the mathematical representation.

That is deliberately not the same as two's complement, the fixed-width form hardware actually uses, where −1 in eight bits is 11111111. If you are reading a register dump or debugging an overflow, you want the two's complement value, and you will need to apply the width yourself: invert the bits of the positive value and add one.

Local

Everything converts in the page, with nothing sent anywhere.

For the one numeral system on this site that a computer never uses, the Roman numeral converter handles it both ways.

questions

Will large numbers lose precision?
No. Conversion uses arbitrary-precision integers, so a 64-bit database ID or a snowflake converts exactly. Converters built on ordinary JavaScript numbers return subtly wrong answers above 2^53 without warning.
Does it recognise 0x and 0b prefixes?
Yes. Values written as 0x1f, 0b1011 or 0o755 are detected from their prefix, so you do not have to tell the tool which base you meant.
Why are Unix file permissions written in octal?
Because each octal digit is exactly three bits, matching the read, write and execute triplet for owner, group and other. That is why 755 is natural in octal and awkward in any other base.
Does it show two's complement for negative numbers?
No. Negatives are shown with a minus sign, the mathematical form. Two's complement is a fixed-width representation, so you must choose the width: invert the bits of the positive value and add one — in eight bits, minus one is 11111111.
What is the highest base supported?
Base 36, which uses all ten digits and all 26 letters. That makes it the most compact case-insensitive way to write a number as text, which is why it appears in short IDs and URL slugs.