Number Base Converter

Convert numbers between binary, octal, decimal, hexadecimal and any base from 2 to 36, with bit-width and two's complement views.

Converter Converters & Formatters Runs in your browser
Try:

Result

Decimal
255
Hexadecimal
0xFF
Binary
0b11111111
Octal
0o377
Bits required
8 of 32
Signed (32-bit)
255

Representations

Binary (byte-grouped)
11111111
Base 32
7V
Base 36
73
Fits in 32 bits
yes
Bytes
1

About Number Base Converter

Base conversion turns up constantly in networking: hex in packet dumps, binary when reasoning about masks, octal in file permissions. This converts between all of them and shows how many bits the value actually needs.

Where each base shows up

Hexadecimal dominates anything byte-oriented because one hex digit is exactly four bits: MAC addresses, IPv6 groups, packet dumps and MPLS labels are all easier to read in hex than in decimal. Octal survives almost exclusively in Unix file permissions, where each digit maps neatly onto a read/write/execute triplet. Binary is where masks and flag fields become obvious — a subnet mask or a TCP flags byte tells you nothing in decimal and everything in binary. Base 32 and base 36 turn up in short identifiers and license keys because they avoid ambiguous characters while staying case-insensitive.

Two's complement in one paragraph

Signed integers store negatives by inverting the bits and adding one, so the top bit indicates sign. In a 32-bit signed field, 0xC0A80101 reads as -1062731519 rather than 3232235777 - which is exactly why IP addresses stored in signed database columns come back negative.

Common use cases

  • Reading a hex value out of a packet capture.
  • Checking whether a value fits a fixed-width protocol field.
  • Converting a bitmask into readable binary.

Edge cases and gotchas

  • JavaScript bitwise operators work on 32 bits; values above 2^53 lose precision without BigInt.

Frequently asked questions

What is the largest value this handles?
Up to 2^53, the safe integer limit in JavaScript. Beyond that, values need BigInt arithmetic, which matters for 64-bit counters and full IPv6 addresses — use the IPv6 subnet calculator for those.
Why does my hex IP show as negative?
It was read as a signed 32-bit integer. Any address from 128.0.0.0 up has the high bit set. Add 4294967296 to recover the unsigned value.