Integer Base Converter

What is an Integer Base Converter?

A number can be written in many bases. Humans use base 10, computers work in base 2, and programmers read memory addresses, colours and permissions in base 16 (hexadecimal) or base 8 (octal). This converter shows an integer in all common bases at once, so you can move between them without mental arithmetic.

How to use it

  1. Enter a number and choose the base it is written in.
  2. Read the value in binary, octal, decimal, hexadecimal and other bases.
  3. Copy the representation you need.

Example: 255

  • Binary (base 2): 11111111
  • Octal (base 8): 377
  • Decimal (base 10): 255
  • Hexadecimal (base 16): FF
  • Base 36: 73

How base conversion works

To convert from decimal, divide repeatedly by the target base and read the remainders from last to first. 255 ÷ 16 = 15 remainder 15, and 15 ÷ 16 = 0 remainder 15, giving F F. To convert back, multiply each digit by the base raised to its position: F × 16 + F = 15 × 16 + 15 = 255.

Shortcuts between binary, octal and hex

Each hex digit is exactly 4 bits and each octal digit is exactly 3 bits, so you can convert by grouping. 1101 0110 in binary is D6 in hex. That is why hex is the standard way to display bytes.

Prefixes in code

  • 0x for hex, 0b for binary and 0o for octal in JavaScript, Python, Rust and many other languages.
  • In C and older JavaScript, a leading zero alone means octal, so 010 is 8. Avoid leading zeros for decimal numbers.
  • JavaScript numbers are exact only up to 2^53; use BigInt for larger values.

Frequently Asked Questions

How do I convert decimal to hexadecimal?

Divide by 16 repeatedly and write the remainders in reverse order, using A to F for 10 to 15. For example, 255 becomes FF.

Why is hexadecimal used in programming?

Each hex digit represents exactly 4 bits, so a byte is always two hex digits, which makes binary data easy to read.

What does the 0x prefix mean?

It marks a number as hexadecimal in most programming languages.

What is base 36?

A base that uses the digits 0 to 9 and the letters A to Z, often used for short alphanumeric identifiers.