Number Base Converter

Type a whole number in any base below. The other fields update instantly. Digits are validated per base (binary: 0–1, octal: 0–7, decimal: 0–9, hex: 0–9 and A–F).

What are number bases?

A positional number system writes values as digits multiplied by powers of a base. In decimal (base 10), each place is a power of 10; in binary (base 2), each place is a power of 2. The same quantity can be written in any base: you are only changing how you group and name the bundles.

Why programmers use hex

Hex is compact: one byte (8 bits) fits in just two hex digits. It also aligns cleanly with bits because one hex digit always represents four bits (a nibble). That makes memory addresses, color codes, and binary file dumps easier to read than long binary strings.

Conversion example: 255 in all bases

  1. Decimal: 255 means 2×10² + 5×10¹ + 5×10⁰.
  2. Binary: 255 is 11111111₂ — eight 1s, i.e. 2⁸−1.
  3. Octal: group bits in threes from the right: 11 111 111 → 377₈.
  4. Hex: group bits in fours: 1111 1111 → FF₁₆.

Try typing 255 in decimal, or FF in hex, and watch the other fields match this pattern.

Frequently asked questions

What is the largest integer this converter handles safely?
JavaScript can represent integers exactly up to 2⁵³ − 1 (9007199254740991). Beyond that, rounding errors may appear.
Does the converter support negative numbers?
Yes. Enter a leading minus in any field; the value is parsed with parseInt and shown consistently in the others.
Why does my binary input show as invalid?
Binary allows only 0 and 1. If you type 2 or 8 in the binary field, validation fails until you correct the digits. Octal rejects 8 and 9; hex allows A–F.

Related tools