Base Converter

A free number base converter that turns any integer into binary, octal, decimal and hex at once, and does arithmetic and bitwise operations in the base you choose.

Convert between bases

Converted values

Binary (base 2)
1111 1111
Octal (base 8)
377
Decimal (base 10)
255
Hexadecimal (base 16)
FF

Calculate in a base

Result

1 0000
Decimal (base 10)
16

How to use

  • In “Convert between bases”, type a number and pick its base. The binary, octal, decimal and hexadecimal values appear right away. Pick any other base from 2 to 36, such as base 3 or base 36, to see that value too.
  • Letters are not case-sensitive, and spaces and underscores (_) are ignored. You can keep the prefix that matches the chosen base: 0b for binary, 0o for octal and 0x for hex.
  • In “Calculate in a base”, choose binary, octal, decimal or hex, enter two numbers and pick an operation. The result is shown in that base and in decimal. Division shows the quotient and the remainder.
  • Binary results are grouped in fours from the right for readability. Spaces are ignored, so you can copy a grouped value and paste it back in unchanged.

How base conversion works

  • In base N, the digits from the right are worth 1, N, N², N³ and so on. Decimal 352 = 3×100 + 5×10 + 2×1, and every other base is read the same way.
  • Base N to decimal: multiply each digit by its place value and add the results. 1011₂ = 1×8 + 0×4 + 1×2 + 1×1 = 11
  • Decimal to base N: divide by N repeatedly until the quotient is 0, then read the remainders from the last one to the first.
  • Hex uses 0–9 and then A (10) to F (15); base 36 uses letters all the way to Z (35). 2AF₁₆ = 2×256 + 10×16 + 15 = 687
  • Four binary digits make one hex digit and three make one octal digit, so converting between binary and hex or octal is just grouping. 1111 1111₂ = 377₈ = FF₁₆ = 255

Step by step: decimal 200 to binary and hex

  • Step 1, divide by 2: 200 ÷ 2 = 100 r 0, 100 ÷ 2 = 50 r 0, 50 ÷ 2 = 25 r 0, 25 ÷ 2 = 12 r 1
  • Step 2, keep going until the quotient is 0: 12 ÷ 2 = 6 r 0, 6 ÷ 2 = 3 r 0, 3 ÷ 2 = 1 r 1, 1 ÷ 2 = 0 r 1
  • Step 3, read the remainders from the last one up: 11001000, so 200 = 1100 1000₂.
  • Step 4, group the binary digits in fours: 1100 = C and 1000 = 8, so the hex value is C8. Grouped in threes (11, 001, 000) it gives octal 310.
  • Check: C8₁₆ = 12×16 + 8 = 200 and 310₈ = 3×64 + 1×8 + 0 = 200

Calculation examples

  • 1010₂ + 0110₂ = 1 0000₂ (in decimal, 10 + 6 = 16)
  • 1111₂ ÷ 100₂ = quotient 11₂, remainder 11₂ (in decimal, 15 ÷ 4 = 3 remainder 3)
  • 1100₂ AND 1010₂ = 1000₂, OR gives 1110₂ and XOR gives 110₂ (8, 14 and 6 in decimal)
  • A5₁₆ XOR FF₁₆ = 5A₁₆ (in decimal, 165 XOR 255 = 90). XOR with FF flips all of the lowest 8 bits.
  • FF₁₆ + 1 = 100₁₆ (in decimal, 255 + 1 = 256)

Good to know

  • Negative numbers keep their sign (−5 → −101₂). For an 8-bit two’s complement form, convert 256 − 5 = 251 to get 1111 1011₂ (FB₁₆); for 16 bits, convert 65536 − 5 = 65531 (FFFB₁₆).
  • A prefix is removed only when it matches the chosen base. With hex selected, 0b11 is read as B11₁₆ (2833 in decimal), so pick binary before entering a binary value.
  • Division rounds the quotient toward zero, and the remainder takes the sign of the first number: −7 ÷ 2 = quotient −3, remainder −1.
  • Only integers are accepted, and a decimal point triggers a message saying so. There is no digit limit, so very long numbers are handled exactly.

Frequently asked questions

How do I convert binary to decimal?

Choose binary in “Convert between bases” and type the number; the decimal value appears instantly. By hand, multiply the digits from the right by 1, 2, 4, 8 and so on and add them up, so 1011₂ = 8 + 2 + 1 = 11.

How do I convert decimal to hexadecimal?

Divide by 16 repeatedly and read the remainders in reverse. 200 ÷ 16 = 12 r 8 and 12 ÷ 16 = 0 r 12 (C), so 200 = C8₁₆.

What is hex FF in decimal?

FF in hex is 255 in decimal. F stands for 15, so FF₁₆ = 15×16 + 15 = 255, which is 1111 1111 in binary.

Can I convert negative numbers?

Yes, put a minus sign in front and the sign is kept, as in −FF₁₆ = −255. The converter does not produce fixed-width two’s complement forms such as 8-bit or 16-bit values; for those, convert the value subtracted from a power of 2, such as 256 − 5 = 251.

How do AND, OR and XOR work with negative numbers?

Negative numbers are treated as two’s complement with an endless run of 1s on the left. For example, −5 AND 3 = 3 and −1 XOR 5 = −6, and a note under the result explains this.

Can I convert numbers with a decimal point?

No, only integers are supported. In return there is no digit limit, so even very long integers are converted exactly.

What bases are supported?

Any base from 2 to 36 can be converted. Digits above 9 are the letters A (10) to Z (35), so ZZ₃₆ = 1295, and calculations work in binary, octal, decimal and hex.