Number Base Converter
Convert numbers between binary, decimal, hexadecimal, octal, and any custom base — with bit grouping, signed integers, and step-by-step explanation.
Last updated: March 25, 2026
Find this tool useful? Support the project to keep it free!
Buy me a coffeeWhat is Number Base Converter?
A number base (or radix) defines how many unique digits are used to represent numbers. The familiar decimal system uses base 10 (digits 0–9). Computers internally work exclusively in binary (base 2, digits 0–1) because electronic transistors have exactly two states: on/off. Hexadecimal (base 16, digits 0–9 and A–F) is a compact shorthand for binary — exactly 4 binary bits map to one hex digit, making memory addresses, color codes, and byte values much shorter to write and read.
Octal (base 8, digits 0–7) was historically used in early Unix file permissions (chmod 755) and is still encountered in legacy systems. Understanding number bases is fundamental to reading memory dumps, working with bitwise operations, CSS color codes (#RRGGBB hex), network IP addressing (binary subnet masks), and low-level systems programming. This converter handles all standard bases (2, 8, 10, 16) and any custom base from 2 to 36, with optional 2's complement signed integer representation.
How to Use Number Base Converter
Type a number into any of the four fields (Binary, Octal, Decimal, or Hexadecimal)
All other base representations update instantly as you type — no manual conversion needed
Toggle "Show Bit Groups" to display binary numbers in 4-bit nibble groups (e.g., 1010 1111) or 8-bit byte groups for easier reading
Toggle "Signed Integer" to see the 2's complement representation for the selected bit width (8-bit, 16-bit, 32-bit)
Click "Step-by-Step" to see the full mathematical conversion process explained with each multiplication/division step
Common Use Cases
- Converting CSS hex color codes (#1E90FF) to RGB decimal channel values (30, 144, 255) for programmatic manipulation
- Understanding Unix file permissions: chmod 755 in octal = 111 101 101 in binary = rwx r-x r-x
- Reading memory dump output in hex — converting addresses like 0x7FFE8000 to decimal for comparison
- Debugging bitwise operations: checking what 0b10110011 & 0b11110000 equals in decimal
- Converting network subnet masks: 255.255.255.0 = 11111111.11111111.11111111.00000000 (/24)
- Working with Arduino/embedded systems where hardware registers are documented in binary bit fields
- Converting ASCII character codes (decimal) to their hex representation for HTTP encoding or URL encoding
- Understanding 2's complement negative numbers: how -1 is stored as 0xFF in an 8-bit signed integer
Example Input and Output
Converting the hex color code for "Dodger Blue" to all bases:
Hex input: 1E90FF
(CSS color: #1E90FF — Dodger Blue)Decimal: 1,610,751
Binary: 0001 1110 1001 0000 1111 1111
Octal: 6110377
Hexadecimal: 1E90FF
Breakdown for CSS RGB:
R: 1E hex = 30 decimal
G: 90 hex = 144 decimal
B: FF hex = 255 decimal
→ rgb(30, 144, 255)How This Tool Works
User input in any base field is parsed using parseInt(input, currentBase). The resulting JavaScript Number is converted to all other bases using .toString(targetBase). For binary "bit group" display, the binary string is zero-padded to the next multiple of 4 or 8, then split into groups with spaces. For the step-by-step view, the repeated-division algorithm is simulated step by step and each step's quotient and remainder are rendered as an explanation list.
Technical Stack
Client-Side Processing
All base conversions run in your browser using JavaScript's built-in parseInt() and Number.prototype.toString(). No data is sent to our servers.
JavaScript Built-in Conversion
JavaScript parseInt(string, radix) parses any base: parseInt("FF", 16) = 255, parseInt("1010", 2) = 10, parseInt("17", 8) = 15. Number.prototype.toString(radix) converts to any base: (255).toString(16) = "ff", (10).toString(2) = "1010". BigInt handles numbers beyond Number.MAX_SAFE_INTEGER (2^53): BigInt("0x1FFFFFFFFFFFFF").toString(10) for large conversions.
Bit Width and Overflow
When working with specific hardware registers or data types, bit width matters. An 8-bit unsigned value maximum is 255. If you convert 256 to 8-bit binary, you overflow: 256 mod 256 = 0. Use the "Bit Width" selector to see how a value wraps at 8, 16, 32, or 64 bits — critical for understanding overflow bugs in C, Rust, or assembly code.
Frequently Asked Questions
Why do computers use binary instead of decimal?
Electronic circuits are built from transistors that have two stable states: conducting (high voltage, representing 1) or not conducting (low voltage, representing 0). It is technically possible to build multi-state electronics (several voltage levels), but two-state transistors are far more reliable, noise-resistant, and manufacturable at scale. Every other base (octal, hex, decimal) used in computing is a human convention layered on top of underlying binary hardware.
What are the digits and maximum values for each base?
Base 2 (binary): digits 0–1. Base 8 (octal): digits 0–7. Base 10 (decimal): digits 0–9. Base 16 (hex): digits 0–9, A (10), B (11), C (12), D (13), E (14), F (15). In any base N, digits go from 0 to N-1. The maximum value in a fixed number of digits: in binary with 8 digits = 11111111 = 255 decimal = 0xFF hex. A byte (8 bits) ranges from 0 to 255 in unsigned representation.
How do I convert hex color codes to RGB manually?
A CSS hex color like #1E90FF is three hex pairs: 1E (red), 90 (green), FF (blue). Convert each pair from hex to decimal: 1E = (1×16) + 14 = 30. 90 = (9×16) + 0 = 144. FF = (15×16) + 15 = 255. Result: rgb(30, 144, 255). Shorthand hex colors (#RGB) expand each digit: #F06 → #FF0066. The reverse: each RGB value from 0–255 converts to hex using Math.round(value).toString(16).toUpperCase().
What is 2's complement and why does it matter for negative numbers?
2's complement is the standard method computers use to represent signed (positive and negative) integers in binary. For an 8-bit integer: positive numbers are represented normally (binary 00000001 = 1). Negative numbers: to get -N, take the binary of N, flip all bits (1's complement), then add 1. Example: -1 in 8-bit = 11111110 + 1 = 11111111 = 0xFF. This is why the maximum signed 8-bit value is 127 (+01111111) and minimum is -128 (10000000).
What is octal and where is it still used?
Octal (base 8) uses digits 0–7. Three binary bits map exactly to one octal digit (similar to how four bits map to one hex digit). Octal was popular in the 1960s-70s when 12-bit and 24-bit machines made hex less natural. Today: (1) Unix file permissions (chmod) still use octal: 755 = rwxr-xr-x. (2) Escape sequences in strings: \077 (ANSI C octal escape). (3) Some microcontroller register documentation. Outside those contexts, hex has almost entirely replaced octal.
How do I convert between bases without a calculator?
Decimal to binary: repeatedly divide by 2, recording remainders: 13 ÷ 2 = 6 R1, 6 ÷ 2 = 3 R0, 3 ÷ 2 = 1 R1, 1 ÷ 2 = 0 R1. Read remainders bottom-to-top: 1101. Binary to hex: group the binary number into fours from the right: 1101 = D in hex. Decimal to hex: divide by 16, record remainders as hex digits. In JavaScript: (255).toString(16) → "ff", parseInt("ff", 16) → 255.
Related Tools
Number to Words Converter
Convert numbers into English words. Handles large integers, negative values, decimals, and comma-separated numbers.
Number to WhatsApp Link Generator
Convert any phone number to a WhatsApp click-to-chat link (wa.me). Paste the number, add an optional pre-filled message, and get a shareable WhatsApp link instantly.
Phone Number to IP Address Converter
Mathematically convert a 10-digit phone number to its IPv4 address equivalent. Shows IP, decimal, hex, and binary outputs.
Binary to Decimal Converter
Convert binary numbers (base 2) to decimal (base 10). Also shows hexadecimal and octal equivalents. Supports large binary numbers.
Binary to Hex Converter
Convert binary numbers (base 2) to hexadecimal (base 16). Also shows decimal and octal equivalents. Supports large binary numbers with BigInt precision.
Binary to Octal Converter
Convert binary numbers (base 2) to octal (base 8). Also shows decimal and hexadecimal equivalents. Supports large binary numbers with BigInt precision.

