Skip to content
Utilboxes

Number Base Converter

Type a number and choose its base to see it in binary, octal, decimal and hexadecimal at once, plus any base from 2 to 36. 255 is 11111111 in binary and FF in hex. Numbers of any size convert exactly, prefixes such as 0x and 0b are accepted, and negative numbers show their two's complement. It runs in your browser.

Runs entirely in your browser

Updated

How to use the Number Base Converter

  1. 1Type the number. Spaces, underscores and a 0x, 0b or 0o prefix are fine.
  2. 2Choose the base it is written in.
  3. 3Read the binary, octal, decimal and hexadecimal values, or set a custom base.
  4. 4Copy any result; copied binary, octal and hex include their prefix.

How it works

A number in base b is read digit by digit: each step multiplies the running total by b and adds the next digit. Digits beyond 9 are the letters a to z, so hexadecimal uses 0–9 and A–F, and base 36 uses every letter.

The arithmetic uses JavaScript's BigInt, so there is no size limit and no rounding. Ordinary JavaScript numbers lose precision above 2⁵³ (about 9 × 10¹⁵), which is why some converters give wrong answers for long binary or hex values.

Digits are grouped in fours for binary and hex (one hex digit is exactly four bits) and in threes for decimal and octal, purely for readability; copying gives the plain digits.

Negative numbers are shown with a minus sign and, below, as the two's complement bit pattern computers use to store signed integers in 8, 16, 32 and 64 bits — for example −1 is 11111111 in 8 bits.

Worked example

Converting 255 from decimal

  1. Binary: 255 = 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 → 11111111
  2. Octal: 255 = 3 × 64 + 7 × 8 + 7 → 377
  3. Hex: 255 = 15 × 16 + 15 → FF

Result: 11111111 (binary), 377 (octal), FF (hex).

Tips and common mistakes

  • Use hex to read binary quickly: each hex digit is exactly four bits.
  • Check colour codes such as #FF8800 by converting each pair of hex digits to decimal.
  • For file permissions on Unix, octal 755 is binary 111 101 101.
  • Watch the input base: 10 means ten in decimal but two in binary.

Frequently asked questions

How do I convert binary to decimal?
Choose Binary as the input base and type the digits. By hand, add the powers of two for each 1: 1011 is 8 + 0 + 2 + 1 = 11.
How do I convert decimal to hex?
Type the number with Decimal as the input base and read the hexadecimal row. By hand, divide by 16 repeatedly and read the remainders backwards.
What does 0x mean?
It is the prefix programming languages use for hexadecimal, as 0b is for binary and 0o for octal. The converter accepts them when they match the input base.
What is two's complement?
The standard way computers store negative integers: invert every bit of the positive value and add one. In 8 bits, −5 is 11111011.
Can it convert fractions?
No. It converts whole numbers only, positive or negative.
Is anything uploaded?
No. Conversion happens in your browser.