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
chmod 755 means owner gets 7 (4+2+1 = rwx), group gets 5 (4+0+1 = r-x), others get 5 (r-x). Octal maps perfectly to 3-bit groups, making it a compact notation for the 9-bit permission field. Convert 755 from octal to binary to see all nine bits explicitly: 111 101 101.1101. Verify: 8+4+0+1 = 13. The same technique works for any base — divide by the target base and read remainders in reverse.00000101; invert → 11111010; add 1 → 11111011 = −5. The most significant bit acts as the sign bit (1 = negative). Two's complement allows addition and subtraction to work with the same hardware circuit for both positive and negative numbers — a key reason it is universally used.0100 0010 (4 = 0100, 2 = 0010). BCD avoids the floating-point rounding errors of binary arithmetic for decimal fractions, making it ideal for financial calculations, cash registers, and accounting systems where exact cent values must be preserved. SQL's DECIMAL type and Java's BigDecimal internally use BCD-like representations.data:image/png;base64,...), and JWT tokens all use base-64. It encodes 3 bytes into 4 printable ASCII characters (~33% size increase). Base-32 uses only uppercase letters and digits 2–7, avoiding ambiguous characters (0, 1, O, l) — making it human-readable and used for TOTP secret keys (two-factor auth), Crockford encoding, and some geohash systems.FF = red (255), 57 = green (87), 33 = blue (51). Each byte ranges from 00 (0) to FF (255). An optional 4th byte (#FF5733CC) controls alpha/opacity where CC hex = 204 decimal ≈ 80% opaque. The shorthand form #F53 expands each digit to a doubled pair (#FF5533). Converting the hex pairs to decimal gives you the equivalent rgb(255, 87, 51) CSS value.About This Number Base Converter
This free number base converter converts integers between binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16). Enter a value in any base and all others update instantly.
Understanding positional notation is fundamental in computer science — binary maps directly to hardware logic, hexadecimal is used in colour codes and memory addresses, and octal appears in Unix file permissions.
When to use this tool
- Converting hex colour codes to decimal RGB values
- Reading binary or hex data from network packets and memory
- Understanding Unix chmod permission bits expressed in octal
- Learning positional notation across number bases
Standards & References
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.
Related Developer Tools
Related Articles
View all articles
IEEE 754 Floating-Point: Why 0.1 + 0.2 ≠ 0.3 and What to Use for Financial Calculations
0.1 + 0.2 ≠ 0.3 in nearly every programming language — because 0.1 can't be represented exactly in binary. Here's the IEEE 754 bit structure (sign, exponent, mantissa), special values (NaN, Infinity, -0), why integers above 2^53 lose precision in JavaScript, and why financial code should never use floats.
#FF5733, 00:1A:2B:3C:4D:5E, and IPv6: Three Everyday Hex Formats, Three Different Reasons for Hex
Color codes, MAC addresses, and IPv6 addresses all use hexadecimal — but for different reasons rooted in what each format actually represents. Here's how hex's "two digits per byte" property makes color codes' three-channel structure visible at a glance, why MAC addresses' hex grouping aligns with manufacturer-ID lookups, why IPv6's 128-bit addresses would be unwieldy in decimal, and how the "::" shorthand compresses runs of zero-groups.
Bit Manipulation and Bitmasks: From Unix Permissions to Feature Flags
Bit manipulation is where number bases become practical: Unix permissions, feature flags, IP subnetting, and protocol fields all use bitmasks. Here's how AND, OR, XOR, and shifts work, with real examples from file permissions and flag systems.
Negative Numbers, Overflow, and What Hex Reveals About Your Data
Most developers can convert hex to decimal — but two's complement, signed overflow, and bit-width boundaries are where base conversion becomes genuinely useful for debugging real problems.
Number Base Converter — Binary, Octal, Decimal & Hex Explained
Learn how binary, octal, decimal, and hexadecimal number systems work, when each is used in programming, and how to convert between them instantly with a free number base converter.