Number Base Converter

Convert numbers between binary, octal, decimal, hexadecimal, and other number bases.

Input

Bit Information

Bit length:8
Byte length:1
1s count:8
0s count:0
Power of 2:No
Even:No

Decimal Value

255

All Conversions

Binary (Base 2)
1111 1111
Octal (Base 8)
377
Decimal (Base 10)
255
Hexadecimal (Base 16)
FF
Base32
7V
Base36
73

Base Reference

Binary (2): 0, 1

Octal (8): 0-7

Decimal (10): 0-9

Hex (16): 0-9, A-F

Base36: 0-9, A-Z

What Is Number Base Conversion?

A number base — also called a radix — defines how many unique digits a positional numeral system uses before rolling over to the next place value. The familiar decimal system uses base 10 (digits 0–9); binary uses base 2 (digits 0–1); hexadecimal uses base 16 (digits 0–9 plus letters A–F). Every positive integer can be expressed in any of these systems, and the underlying quantity never changes — only the written representation does.

Number base conversion is one of the most fundamental skills in computer science and digital electronics. Processors store and manipulate all data in binary form, yet programmers routinely read memory addresses in hexadecimal, file permissions in octal, and business logic in decimal. Being able to fluently move between these representations lets you decode hardware data sheets, write low-level bit-manipulation code, interpret network protocols, and understand how data is laid out in memory.

Our number base converter calculator handles the conversion automatically. You enter a number in any supported base — binary, octal, decimal, hexadecimal, base-32, base-36, or any custom base from 2 to 36 — and the tool instantly displays every other representation simultaneously. You also get bit-length information, byte count, ones and zeros counts, and whether the value is a power of two — all of which are useful diagnostics when working at the hardware or systems-programming level.

This guide explains the mathematics behind positional notation, walks through manual conversion procedures, and shows you how the calculator applies JavaScript's built-in parseInt and Number.prototype.toString to produce fast, accurate results for any integer you enter.

How Number Base Conversion Works

Every number in a positional system can be understood as a sum of digits multiplied by powers of the base. In decimal, the number 255 means (2 × 10²) + (5 × 10¹) + (5 × 10⁰) = 200 + 50 + 5 = 255. The same value in binary is 11111111, which expands to (1×2⁷)+(1×2⁶)+(1×2⁵)+(1×2⁴)+(1×2³)+(1×2²)+(1×2¹)+(1×2⁰) = 128+64+32+16+8+4+2+1 = 255. Both representations encode the same quantity — they just use different bases.

To convert from any base to decimal, you multiply each digit by the appropriate power of the base and sum the results. This is exactly what JavaScript's parseInt(string, radix) does internally. To convert from decimal to another base, you repeatedly divide by the target base, collecting remainders from right to left. JavaScript's Number.prototype.toString(radix) implements this division-remainder algorithm and returns the result as a string — for bases above 10 it uses lowercase letters a–z for digit values 10–35, which the calculator then uppercases for readability.

The tool also groups binary output into nibbles (4-bit groups) separated by spaces — for example, 11111111 becomes "1111 1111" — and groups hexadecimal output into byte pairs — FF becomes "FF". These visual groupings mirror how engineers actually read binary and hex dumps, making it easier to spot byte boundaries and bit patterns at a glance.

For the bit-analysis panel, the calculator counts the total number of binary digits (bit length), computes the minimum number of bytes required to store the value using Math.ceil(bitLength / 8), tallies set bits (1s) and unset bits (0s), and checks for power-of-two status using the bitwise identity (n & (n-1)) === 0. A power of two has exactly one set bit in its binary representation, which is a commonly exploited property in hashing, memory allocation, and data-structure sizing.

Number Base Conversion Formulas

decimal = parseInt(inputString, fromBase) | output = decimal.toString(targetBase).toUpperCase()

Where:

  • inputString= The number entered by the user, as a string of digits valid for the source base (e.g., "FF" for hex, "11111111" for binary)
  • fromBase= The radix of the input number — an integer from 2 to 36 (e.g., 2 for binary, 16 for hexadecimal)
  • decimal= The intermediate base-10 integer produced by parseInt; all other outputs are derived from this value
  • targetBase= The radix for the output representation (2, 8, 10, 16, 32, or 36 in the preset buttons; or any integer 2–36 via the custom base option)
  • parseInt(s, r)= JavaScript built-in that reads string s as an integer in radix r, returning a base-10 Number
  • toString(r)= JavaScript Number method that converts a base-10 integer to a string representation in radix r, using digits 0–9 and letters a–z
  • bitLength= The number of binary digits in the result, equal to Math.floor(log₂(decimal)) + 1
  • byteLength= Minimum bytes to store the value: Math.ceil(bitLength / 8)

Binary, Octal, Decimal, and Hexadecimal Explained

Binary (base 2) is the native language of digital hardware. Every transistor is either off (0) or on (1), so all processor instructions, memory addresses, and file contents ultimately exist as streams of binary digits. Understanding binary is essential for bit manipulation, bitwise operators in programming, networking (subnet masks), and cryptography.

Octal (base 8) uses digits 0–7. It was common on early minicomputers and mainframes because each octal digit maps cleanly to exactly three binary digits — so the binary string 111 111 111 becomes 7 7 7 in octal. Today octal survives primarily in Unix/Linux file permission notation: chmod 755 uses three octal digits to encode read/write/execute bits for owner, group, and others.

Decimal (base 10) is what humans use every day. It has ten digits (0–9) and every place value is a power of 10. While computers do not work natively in decimal, all human-readable output — prices, counts, measurements — is expressed in decimal. The decimal value serves as the universal pivot point in this calculator: every input is first parsed into a decimal integer, then expressed in all target bases.

Hexadecimal (base 16) is the workhorse of programming and digital systems. Its sixteen digits (0–9 and A–F) mean that each hex digit represents exactly four binary bits (one nibble), so two hex digits encode a full byte. Memory addresses, color codes (#FF5733), MAC addresses, SHA hashes, and machine-code listings are all written in hex because it is far more compact than binary and still maps one-to-one onto bytes.

Base-32 uses digits 0–9 and letters A–V (or in some standards A–Z and 2–7). It is used in certain encoding schemes for file names, DNS labels, and TOTP (time-based one-time password) secret keys because it avoids ambiguous characters like 0/O and 1/I/l. Base-36 uses all ten digits plus all 26 letters of the alphabet, producing the most compact human-readable integer representation without case sensitivity — useful for URL shorteners and compact ID generation.

Understanding Bit Analysis and Properties

Beyond simple base conversion, this calculator provides a bit analysis panel that surfaces several important properties of a number's binary representation. These properties appear constantly in low-level programming, algorithm design, and computer architecture, and knowing them by inspection can save significant debugging time.

Bit length is the number of binary digits required to represent the value, which equals ⌊log₂(n)⌋ + 1 for any positive integer n. For example, 255 requires 8 bits (11111111), while 256 requires 9 bits (100000000). Bit length determines the minimum word size a CPU register must have to hold a value, and it feeds directly into the byte length calculation: Math.ceil(bitLength / 8) gives the number of full bytes needed.

Ones count (also called Hamming weight or popcount) is the number of set bits in the binary representation. This value matters in error-correcting codes, hashing algorithms, population counting for sets, and SIMD (single-instruction multiple-data) operations. A ones count of 1 means the number is a power of two. High ones counts indicate values with many flags set simultaneously, which is useful when reading bitmask registers.

Power of two detection uses the identity (n & (n - 1)) === 0: subtracting 1 from a power of two flips its single set bit and all lower bits, so AND-ing with the original always yields zero. This check is O(1) and is used everywhere from hash table sizing (powers of two allow cheap modulo via bitwise AND) to memory-aligned allocation. The calculator flags this property explicitly so you can identify it at a glance.

Even or odd is determined by the least-significant bit: if bit 0 is 0 the number is even; if it is 1 the number is odd. This is equivalent to n % 2 === 0 but the bitwise version (n & 1) is marginally faster and appears in performance-critical inner loops. Understanding this property is a stepping stone to more advanced bit manipulation tricks used throughout systems and competitive programming.

Practical Uses of Number Base Conversion

Number base conversion is not just a classroom exercise — it arises in real engineering and programming work every day. Here are the most common scenarios where a reliable base converter calculator saves time.

Web and graphic design: CSS colors are specified as six-digit hex codes like #1A2B3C. To understand what decimal red, green, and blue components those hex pairs represent, you convert each pair (1A, 2B, 3C) from hexadecimal to decimal to get the RGB values (26, 43, 60). Going the other direction — adjusting an RGB color and encoding it back to hex — is equally common.

Network administration: IPv4 addresses are four decimal octets (e.g., 192.168.1.1), but subnet masks and bitwise network calculations require binary representations. Converting 255.255.255.0 to binary immediately reveals the /24 prefix length. IPv6 addresses use hexadecimal groups, so hex-to-decimal and hex-to-binary conversions are a daily occurrence for network engineers.

Assembly and embedded programming: Processor register values, port addresses, and interrupt vectors are almost always given in hexadecimal in datasheets. Translating hex to binary lets you see exactly which bits are set in a control register, enabling you to safely flip individual flags without disturbing others using bitmask operations.

Permissions and security: Unix file permissions use octal notation. The permission chmod 644 means owner has read+write (6 = 110 in binary), group has read-only (4 = 100), and others have read-only (4 = 100). Converting octal to binary makes the permission bits immediately interpretable.

Data encoding: Base-64 and base-32 encoding schemes represent binary data as ASCII text for safe transmission over protocols that handle only printable characters. Understanding how larger bases pack more bits per character — base-32 uses 5 bits per character, base-64 uses 6 — helps you reason about encoding overhead and choose the right scheme for your use case.

Worked Examples

Decimal 255 to All Common Bases

Problem:

Convert the decimal number 255 to binary, octal, and hexadecimal.

Solution Steps:

  1. 1Select "Decimal (10)" as the input base and enter 255.
  2. 2Binary: 255 ÷ 2 repeatedly gives remainders 1,1,1,1,1,1,1,1 → read bottom-up: 11111111. Verify: 128+64+32+16+8+4+2+1 = 255. ✓
  3. 3Octal: 255 ÷ 8 = 31 remainder 7; 31 ÷ 8 = 3 remainder 7; 3 ÷ 8 = 0 remainder 3. Read remainders bottom-up: 377. Verify: 3×64 + 7×8 + 7×1 = 192+56+7 = 255. ✓
  4. 4Hexadecimal: 255 ÷ 16 = 15 remainder 15; 15 ÷ 16 = 0 remainder 15. Both remainders are 15, which is the digit F. Result: FF. Verify: 15×16 + 15×1 = 240+15 = 255. ✓
  5. 5The calculator also shows Base32 = 7V and Base36 = 73. Bit length = 8, byte length = 1, ones count = 8, power of two = No, even = No.

Result:

Binary: 11111111 | Octal: 377 | Decimal: 255 | Hex: FF | Base32: 7V | Base36: 73

Binary 1010 1100 to Decimal and Hex

Problem:

Convert the binary number 10101100 (a common bitmask pattern) to decimal and hexadecimal.

Solution Steps:

  1. 1Select "Binary (2)" as the input base and enter 10101100.
  2. 2Decimal: sum each set bit by position. Bit 7=1 (128), bit 6=0, bit 5=1 (32), bit 4=0, bit 3=1 (8), bit 2=1 (4), bit 1=0, bit 0=0. Total = 128+32+8+4 = 172.
  3. 3Hexadecimal: split into nibbles: 1010 = A (10 in decimal), 1100 = C (12 in decimal). Result: AC. Verify: 10×16 + 12 = 160+12 = 172. ✓
  4. 4Bit analysis: bit length = 8, byte length = 1, ones count = 4, zeros count = 4, power of two = No (172 & 171 = 10101100 & 10101011 = 10101000 ≠ 0), even = Yes (bit 0 is 0).

Result:

Decimal: 172 | Hex: AC | Octal: 254 | Base32: 5C | Base36: 4O

Hexadecimal 1F4 to Decimal and Binary

Problem:

Convert the hex value 1F4 (a common HTTP status code in hex) to decimal and binary.

Solution Steps:

  1. 1Select "Hexadecimal (16)" as the input base and enter 1F4.
  2. 2Decimal: expand each hex digit by position. 1×16² + F(15)×16¹ + 4×16⁰ = 1×256 + 15×16 + 4×1 = 256+240+4 = 500.
  3. 3Binary: 500 in binary. 500 = 256+128+64+32+16+4 = 111110100. Verify: 256+128+64+32+16+4 = 500. ✓
  4. 4Bit length = 9, byte length = 2 (Math.ceil(9/8) = 2), ones count = 6, even = Yes.

Result:

Decimal: 500 | Binary: 111110100 | Octal: 764 | Hex: 1F4 | Base32: FI | Base36: DW

Octal 755 to Decimal and Binary (Unix Permissions)

Problem:

Convert the Unix file permission octal 755 to binary and decimal to understand which permission bits are set.

Solution Steps:

  1. 1Select "Octal (8)" as the input base and enter 755.
  2. 2Decimal: 7×64 + 5×8 + 5×1 = 448+40+5 = 493.
  3. 3Binary: parse each octal digit to 3-bit binary: 7 → 111, 5 → 101, 5 → 101. Combined: 111101101.
  4. 4Reading permissions: owner = 111 (rwx = read+write+execute), group = 101 (r-x = read+execute), others = 101 (r-x = read+execute). This is the standard web server binary permission.
  5. 5Bit length = 9, ones count = 7, even = No (bit 0 is 1).

Result:

Decimal: 493 | Binary: 111101101 | Hex: 1ED | Octal: 755

Tips & Best Practices

  • To quickly convert hex to binary, replace each hex digit with its 4-bit binary equivalent: 0=0000, 1=0001, …, F=1111.
  • Any number ending in 0 in binary is even; any number ending in 1 is odd — the least-significant bit is always the parity bit.
  • A hexadecimal value with exactly two digits (00–FF) always represents a single byte (0–255). This is the range of each RGB color channel.
  • Octal digits 0–7 each map to exactly 3 binary digits (000–111), making octal a compact shorthand for binary in 3-bit groups.
  • To check if a number is a power of two without a calculator, verify it has exactly one "1" in its binary representation.
  • Base-32 is useful when you need compact, case-insensitive encoding that avoids ambiguous characters like 0 (zero) and O (letter O).
  • When reading a hex memory dump, mentally split each byte into two nibbles: high nibble × 16 + low nibble = decimal byte value.
  • The binary grouped display (nibbles separated by spaces) makes it easier to spot byte boundaries and identify set/cleared bit regions.
  • Use the custom base option to explore bases like base-3 (ternary), base-4 (quaternary), or base-12 (duodecimal) for educational purposes.

Frequently Asked Questions

The calculator supports all integer bases from 2 to 36. The preset buttons cover the six most commonly used bases: binary (2), octal (8), decimal (10), hexadecimal (16), base-32, and base-36. For any other radix — such as base-3 (ternary), base-5 (quinary), or base-12 (duodecimal) — enable the custom base option and type in any integer between 2 and 36. Digits for values 10–35 are entered and displayed using uppercase letters A through Z.
For bases above 10, digits with values 10 through 35 are represented by letters A through Z. The calculator accepts both uppercase and lowercase input — it normalizes your entry to uppercase automatically. For example, in hexadecimal (base 16) you can type "ff" or "FF" and both will be parsed as the decimal value 255. In base-36, "Z" represents the digit value 35.
The converter uses JavaScript's standard 64-bit floating-point Number type, which can represent integers exactly up to 2⁵³ − 1 (approximately 9 quadrillion or 9,007,199,254,740,991 in decimal). For values beyond this limit, JavaScript may lose precision in the least-significant digits. If you need to work with very large integers — such as cryptographic key material — you would need a BigInt-based implementation.
A number is a power of two if it equals 2ⁿ for some non-negative integer n (i.e., 1, 2, 4, 8, 16, 32, 64, 128, 256, …). Powers of two have exactly one bit set in their binary representation. This property is heavily exploited in computer science: hash table sizes are often powers of two so that a modulo operation can be replaced with a cheap bitwise AND (n % size becomes n & (size-1)). Memory allocators, image dimension requirements in GPUs, and FFT algorithm inputs also favor powers of two for efficiency.
The calculator groups binary digits into nibbles — sets of four bits — for readability. Four binary digits correspond to exactly one hexadecimal digit, which makes it easy to cross-reference the binary and hex representations side by side. For example, 11111111 displayed as "1111 1111" makes it immediately clear that this is two hex F digits (FF). This grouping convention is standard in processor datasheets, register documentation, and computer architecture textbooks.
Byte length is computed as Math.ceil(bitLength / 8), where bitLength is the number of binary digits in the result. It tells you the minimum number of 8-bit bytes required to store the integer value. For example, decimal 255 needs exactly 1 byte (bit length 8, 8÷8 = 1), while decimal 256 needs 2 bytes (bit length 9, Math.ceil(9/8) = 2). This is useful when allocating buffer sizes, designing binary file formats, or evaluating storage requirements for integer fields.
Base-36 uses all ten decimal digits plus all 26 letters of the Latin alphabet (case-insensitive), giving it 36 unique digit symbols. Because it uses the full alphanumeric character set without special characters, it produces the most compact integer representation that is safe for use in URLs, file names, and identifiers. URL shorteners, compact unique IDs, and serial number encoders often use base-36 to keep strings short and readable.

Sources & References

Last updated: 2026-06-05

💡

Help us improve!

How would you rate the Number Base Converter?

<>

Editorial Note

MyCalcBuddy Editorial Team

This page is maintained as an educational calculator reference.

Source

Formula Source: Standard Mathematical References

by Various

UpdatedLast reviewed: May 2026
CheckedFormula checks are based on standard references and internal QA review.