Number Base Converter

Convert numbers between binary, octal, decimal, hexadecimal, and any custom base from 2 to 36. Results update in real time as you type — entirely in your browser.

From base:
Base 2 — Binary
0b
Base 8 — Octal
0o
Base 10 — Decimal
   
Base 16 — Hexadecimal
0x
Custom base:
   
Bit info
❤️ Support CodeConverter.net and donate ❤️

Everything you need to know about number bases

What are number bases and why do they matter in programming?

A number base (or radix) defines how many unique digits a positional numeral system uses. Decimal — base 10 — is what humans use every day, with digits 0–9. But computers store everything as binary (base 2), and programmers frequently work in hexadecimal (base 16) or octal (base 8) because they map cleanly to binary. Understanding base conversions is fundamental for low-level programming, networking, cryptography, color codes, and embedded systems work.

For example, the decimal number 255 is 11111111 in binary — all 8 bits set. In hex it's simply FF, which is why CSS color #FFFFFF means maximum red, green, and blue. Octal 0377 is the same value again. One of the most elegant aspects of hex is that every two hex digits map exactly to one byte, making memory addresses and binary data human-readable at a glance.

The four common bases
  • Binary (2) — digits 0–1; native computer storage
  • Octal (8) — digits 0–7; used in Unix permissions
  • Decimal (10) — digits 0–9; everyday counting
  • Hex (16) — digits 0–9 + A–F; compact byte representation
Real-world uses
  • Hex: CSS/HTML colors, memory addresses, MAC & IPv6
  • Binary: bit flags, bitmasks, low-level registers
  • Octal: Unix file permissions (chmod 755)
  • Base-36: compact IDs using 0–9 + a–z
How to use this tool
  • Select the From base of your input number
  • Type (or paste) your number — conversion is real-time
  • All bases update simultaneously below
  • Click any copy icon to copy that result to clipboard
100% private & client-side
  • All calculation happens in your browser
  • Zero data sent to any server
  • Works offline after initial page load
  • No tracking of numbers you enter
JavaScript built-ins
  • parseInt('FF', 16)255
  • (255).toString(16)'ff'
  • (255).toString(2)'11111111'
  • Supports any base 2–36 via parseInt / .toString
Two's complement & negatives
  • This tool converts unsigned integers (positive only)
  • Negative numbers use two's complement in hardware
  • -1 in 8-bit two's complement = 11111111
  • Max safe integer: Number.MAX_SAFE_INTEGER (2⁵³−1)

How does base conversion work?

Every positional numeral system works the same way: each digit position represents a power of the base. In decimal, the number 425 means 4×10² + 2×10¹ + 5×10⁰ = 400 + 20 + 5 = 425. To convert to another base, you repeatedly divide by the target base and collect the remainders. To convert from another base to decimal, multiply each digit by its positional power and sum the results.

This tool uses JavaScript's built-in parseInt(value, fromBase) to parse the input as a decimal integer, then calls .toString(toBase) for each target base. This works reliably for any base between 2 and 36, using digits 0–9 and letters a–z for values 10–35. For very large numbers exceeding JavaScript's safe integer range (Number.MAX_SAFE_INTEGER = 2⁵³−1), consider using the native BigInt type in your own code.