Calc-Masters

Loading precision workspace...

Skip to main content

Base Converter: Convert Binary, Octal, Decimal & Hex Free

Base Converter: Calculate arbitrary-precision integer & fractional radix conversions across Binary, Octal, Decimal, Hex, Base-36 & Base-64. Free, instant.

Preset Benchmarks & Scenarios

Select calibrated scientific or financial benchmarks or start with a clean custom calculation.

  • Custom Scenario (Enter values): Enter your custom parameters below to calculate.
  • Standard Benchmark (Instant calculation ready — enter values and click Calculate): Calibrated institutional benchmark for Base Converter.

Calculation Parameters

Number Base Converter: Binary, Octal, Decimal, and Hexadecimal

Convert any number between binary, octal, decimal, and hexadecimal instantly. See the bit layout, grouped nibbles, and copy any result with one click.

What Is the Base Converter?

A Number Base Converter translates integers between the four number bases that appear most frequently in computing: binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16). Entering a value in any base immediately shows the equivalent in all three others, along with a visual bit layout and grouped binary notation.

Understanding number bases is foundational to computer science, programming, and electronics. Computers store and process everything as binary — sequences of 0s and 1s representing electrical on and off states. But reading long binary strings is slow and error-prone for humans, so hexadecimal is used as a compact shorthand: one hex digit represents exactly four binary bits (a nibble), making large binary values far easier to read and write.

Octal (base 8) is less common today but still appears in Unix file permissions (chmod 755), some legacy protocols, and embedded systems. Decimal is the base humans use for everyday arithmetic and is what programmers typically think in when specifying sizes, counts, and offsets.

Unlike calc-masters's individual base converters (Binary Converter, ASCII Converter), this tool is unified — you enter a value in whichever base you are currently working in and see all four results at once. The interactive bit layout lets you visualise exactly which bits are set for any decimal value, which is particularly useful when working with bitmasks, flags, and bitwise operations.

Key Parameters & Input Variables

  • Positional Polynomial Expansion (N = Σ d_k · r₁^k): Evaluates integer and fractional digits in Source Base r₁ using exact arbitrary-precision BigInt Horner's method and reduced rational fractions.
  • Euclidean Division-with-Remainder Chain (N_i = q_i · r₂ + rem_i): Step-by-step integer conversion into Target Base r₂ reading remainders from Least Significant Digit (LSB) to Most Significant Digit (MSB).
  • Fractional Radix Multiplication & Prime-Factor Termination Proof: Converts fractional parts via iterative multiplication (f_j = ⌊frac_{j-1} · r₂⌋) and proves whether reduced fraction p/q terminates or repeats infinitely by factoring q against r₂.
  • Direct Power-of-Two (2^k) Bit-Group Radix Mapping: Maps binary bits directly into Base-4 (2-bit dibits), Base-8 (3-bit tribits), Base-16 (4-bit nibbles), Base-32 (5-bit quintets), and Base-64 (6-bit sextets).
  • High-Density Developer & Cryptographic Alphabets: Compares IETF RFC 4648 Base32, POSIX Base36, Bitcoin/IPFS Base58, Babylonian Sexagesimal Base-60 (DMS), Short-URL Base62, Base64, and Bijective Base-26.

Common Use Cases & Applications

  • Converting a hexadecimal memory address or color code into its decimal and binary equivalents.
  • Reading Unix file permission octal values (755, 644) in binary to understand which permission bits are set.
  • Working with bitmask flags by visualising which bits are active for a given integer value.
  • Converting between bases while studying computer science, digital logic, or assembly language.
  • Verifying hex values in network packets, file headers, and binary protocols.
  • Translating between bases when reading documentation, datasheets, or debugger output that mixes formats.

Mathematical Formula

All conversions route through decimal as the intermediate step. The input string is parsed using the selected base — for example, parseInt('2D', 16) yields 45 in decimal. The decimal integer is then formatted into each target base using the standard positional notation for that base.

Binary output is grouped into nibbles (groups of four bits, right-aligned) to match how humans and tools typically read binary values — the same grouping used by most debuggers and datasheets. The bit layout visualisation pads the binary value to 8, 16, or 32 bits and highlights the set bits, making bitmask analysis intuitive.

Primary Governing Equation

N = ∑_{k=-m}^{n} d_k · r_1^k;  N_i = q_i · r_2 + rem_i;  f_j = ⌊frac_{j-1} · r_2⌋;  I(r) = log_2(r) bits/char;  E(r, N) = r · (⌊log_r(N)⌋ + 1)

ISO 80000-2 positional polynomial evaluation (Horner's scheme), Euclidean division-with-remainder integer radix conversion, iterative fractional radix multiplication with prime-factor termination proof (rad(q) | rad(r_2)), mixed-radix modular arithmetic, Shannon information capacity, and Radix Economy across Base-2 through Base-64 (including Base32, Base36, Base58, Sexagesimal Base-60, Base62, and Bijective Base-26).

Any base → decimal

decimal = Σ(digit × base^position)

Each digit is multiplied by the base raised to its position (right to left, starting at 0).

Decimal → binary

Repeatedly divide by 2; remainders (right to left) form the binary digits

Standard repeated-division algorithm for base conversion.

Hex ↔ binary shortcut

1 hex digit = 4 binary bits (nibble)

Group binary into fours from the right; each group maps to one hex digit.

Octal ↔ binary shortcut

1 octal digit = 3 binary bits

Group binary into threes from the right; each group maps to one octal digit.

Step-by-Step Calculation Guide

  1. Step 1: Start with the decimal number 45. Converting to binary: 45 = 32+8+4+1 = 101101 in binary, or grouped into nibbles: 0010 1101. Converting to hexadecimal: group the binary nibbles — 0010 maps to 2, 1101 maps to D — giving 0x2D. Converting to octal: group binary into threes — 101 = 5, 101 = 5 — giving 055.
  2. Step 2: Now try it in reverse: entering 2D in hexadecimal. The converter strips the optional 0x prefix, parses 2D as hex (2×16 + 13 = 45), and produces the same decimal, binary, and octal results.
  3. Step 3: The bit layout at 8-bit width shows: 00101101. Bits 0 (value 1), 2 (value 4), 3 (value 8), and 5 (value 32) are set, which sum to 45. This visualisation is directly useful when working with bitfield registers, permission flags, or protocol byte fields.

Sensitivity Analysis & Edge-Case Behavior

Radix String Compression Scaling: Increasing the target radix from Binary (Base-2, 1 bit/char) to Hexadecimal (Base-16, 4 bits/char) reduces string length by exactly 75% (4:1 compression), while Base-64 (6 bits/char) reduces binary string length by 83.3% (6:1 compression).

Prime-Factor Denominator Sensitivity: In Base-10 (prime factors 2 and 5), only fractions whose reduced denominators have the form 2^a · 5^b terminate. In Duodecimal Base-12 (prime factors 2 and 3), 1/3 (0.4₁₂) and 1/6 (0.2₁₂) terminate cleanly, whereas 1/5 (0.24972497...₁₂) repeats periodically.

Common Pitfalls & Errors to Avoid

  • Relying on standard JavaScript parseInt(str, base) for 64-bit integers, which silently loses precision above 2⁵³ - 1 (9,007,199,254,740,991) and ignores invalid trailing digits.
  • Confusing mathematical positional Base-32/Base-64 integer notation with IETF RFC 4648 byte-stream Base32/Base64 (which chunks raw 8-bit bytes and appends '=' padding).
  • Assuming a terminating decimal fraction like 0.1₁₀ or 0.2₁₀ terminates in Binary (Base-2), which causes floating-point accumulation drift in financial software.

Institutional & Industry Applications

Systems Programming & Compiler Design: Translating integer literals (0b, 0o, 0x), memory offsets, and instruction opcodes across architectures.

Distributed Systems & URL Shorteners: Compressing 64-bit UUID/Snowflake primary keys into compact 11-character Base62 or Base58 tokens.

Astronomy, Geodesy & Navigation: Converting decimal degrees and timestamps into Sexagesimal (Base-60) degrees-minutes-seconds (DMS) notation.

Expert Tips & Best Practices

  • Use the Direct Power-of-Two (2^k) Bit-Group Radix Mapper to convert between Binary, Octal (3-bit tribits), Hexadecimal (4-bit nibbles), Base-32 (5-bit quintets), and Base-64 (6-bit sextets) by grouping bits directly without intermediate decimal division.
  • Remember that Base-2 through Base-36 are case-insensitive (A = a = 10), whereas Base-58, Base-62, and Base-64 are strictly case-sensitive.
  • When encoding human-typed tokens or cryptocurrency addresses, prefer Base58 over Base62 or Base64 because Base58 omits visually ambiguous characters (0, O, I, l).

Frequently Asked Questions

How do you convert a number from any source base (r₁) to any target base (r₂)?

Converting between two arbitrary bases r₁ and r₂ is performed in two exact mathematical stages. First, convert the source number from Base r₁ to Decimal (Base-10) using positional polynomial expansion: multiply each digit d_k by r₁^k and sum the terms (N = Σ d_k · r₁^k). Second, convert the Base-10 integer into Target Base r₂ using repeated Euclidean division by r₂, recording the remainders from bottom to top (Most Significant Digit to Least Significant Digit).

How do you convert fractional numbers (numbers with a radix point) between bases?

To convert a fractional value (0.f) from Base-10 into Target Base r₂, repeatedly multiply the fractional part by r₂. At each step, the integer part of the product becomes the next fractional digit in Base r₂ (read from top to bottom), and the remaining fractional part is carried into the next multiplication until the remainder reaches zero or the desired precision (up to 32 places) is met.

Why do some terminating decimal fractions like 0.1 repeat infinitely in Binary (Base-2) and Hexadecimal (Base-16)?

By the Rational Radix Termination Theorem, a reduced fraction p/q terminates in Base r₂ if and only if every prime factor of the denominator q also divides the base r₂. Because 0.1₁₀ = 1/10 has prime factors 2 and 5, and 5 does not divide 2 or 16, 0.1₁₀ becomes an infinite repeating fraction in Binary (0.0001100110011...₂) and Hexadecimal (0.199999...₁₆). Conversely, 1/3 repeats in Base-10 (0.333...) but terminates cleanly in Ternary Base-3 (0.1₃) and Duodecimal Base-12 (0.4₁₂).

What is the difference between Base-36, Base-58, Base-62, and Base-64?

Base-36 uses digits 0–9 and letters A–Z (case-insensitive), making it the largest standard alphanumeric radix supported natively by C strtol() and JavaScript toString(36). Base-62 adds lowercase letters (0–9, A–Z, a–z) for compact URL shorteners and 64-bit database IDs. Base-58 (used in Bitcoin, Solana, and IPFS addresses) removes 0, O, I, and l from Base-62 to prevent visual transcription errors. Base-64 adds two symbols (+ and /) to encode exactly 6 bits per character.

Related Concepts & Terminology

Regulatory & Advisory Disclaimer: Empirical Estimations Only

Calculations and projections displayed by the Base Converter represent mathematical baselines and do not constitute formal financial, medical, legal, engineering, or academic registrar advice. Always verify critical figures with a qualified professional or official institutional syllabus.