Number Base Converter
Convert numbers between Binary (base 2), Octal (base 8), Decimal (base 10), Hexadecimal (base 16), and any custom base from 2 to 36. All client-side.
Frequently Asked Questions
How Number Base Conversion Works
Any positive integer has a unique representation in every base ≥ 2. Conversion is a two-step process using the target base as a pivot.
Parse Input
parseInt(input, fromBase) interprets the digit string in the source base and returns a native JavaScript integer (internally base-10). Non-digit characters for the chosen base immediately produce NaN.
Convert to All Bases
number.toString(toBase) serializes the integer value in the requested base. The same integer value is passed to each toString() call — binary, octal, decimal, and hex results are generated simultaneously.
Custom Bases (2–36)
JavaScript's parseInt and toString support any base from 2 to 36. Bases above 10 use letters: base 16 uses A–F, base 36 uses A–Z (covering all alphanumeric digits).
Common Use Cases
Memory Addresses & Registers
Debuggers and CPU documentation display memory addresses in hex. Converting to decimal or binary helps understand the address space layout, alignment requirements, and offsets.
Unix File Permissions
Unix permissions like chmod 755 are octal. Converting to binary reveals the exact read/write/execute bits for owner, group, and others: 111 101 101 — each 3-bit group maps directly to rwx.
Web Color Values
CSS hex colors like #3d85c8 are three hex byte pairs. Converting each pair (3d, 85, c8) to decimal gives the RGB values (61, 133, 200) used in rgb() and rgba() CSS functions.
Bitfield Operations
Feature flags, bitmasks, and network protocol fields are easiest to understand in binary. Enter a decimal or hex bitmask and instantly see which bits are set without manual calculation.
IP Subnet & Network Math
Subnet masks are binary patterns (e.g., /24 = 24 ones followed by 8 zeros). Converting a subnet mask or IP address to binary makes CIDR calculations and host range math visually clear.
Computer Science Education
Understanding base conversion is foundational to computer science. Use this tool to check manual calculations, explore how the same number looks in different bases, or teach positional notation interactively.