Number Base Converter

Convert between different number bases

Last updated:

About this tool

A number base converter switches an integer between decimal (base 10), binary (base 2), octal (base 8), and hexadecimal (base 16). Programmers reach for hex when reading memory addresses or HTTP byte counts, binary when manipulating bit flags, and octal mostly when setting Unix file permissions like 755 or 644.

How to use

  1. Type a number into any of the four fields — decimal, binary, octal, or hex.
  2. The other three fields update automatically with the equivalent representation.
  3. Click Copy on any row to grab that representation for your code or terminal.
  4. Use the leading 0x prefix as appropriate when pasting into source code.
  5. Watch for invalid input warnings if you mix incompatible characters (e.g., 9 in binary).

Common use cases

  • Reading a memory address from a stack trace and finding the decimal offset.
  • Translating Unix file permissions between symbolic (rwxr-xr-x) and octal (755) form.
  • Decoding a network packet field given as hex into the underlying integer value.
  • Working with bitmask flags by viewing the binary representation.
  • Converting an RGB channel value (0–255) into the hex pair used in a CSS color.
  • Checking that a hex constant in your code matches the decimal value in a spec.

Frequently asked questions

Q. Why does 10 in hex equal 16 in decimal?

A. Hex (base 16) digits go 0-9 then A-F. Position values are 16⁰, 16¹, … so "10" hex means 1×16 + 0 = 16.

Q. Are negative numbers supported?

A. For most calculator use the tool sticks to non-negative integers. Negative values in binary need an explicit width and two-complement encoding, which differs by platform.

Q. How big a number can I convert?

A. JavaScript handles integers up to 2^53 - 1 safely. Beyond that you need BigInt; this tool focuses on the typical 32/64-bit range.

Q. Why does the hex representation use uppercase letters?

A. Convention only. Lowercase is equally valid (and what JavaScript .toString(16) produces by default). Many specs and tools display uppercase for readability.