Skip to content

Methodology & Correctness

What HexConvert.io guarantees about its results, where the limits are, and how those guarantees are tested. Last verified: .

Why every integer path uses BigInt

A JavaScript Number is a 64-bit float. It represents integers exactly only up to 2^53 - 1 (9007199254740991). Above that, values silently round: 9007199254740993 becomes 9007199254740992. For a conversion tool that is an unacceptable failure mode, so every integer on this site is parsed and converted with BigInt end to end. Digits go in, exact digits come out - there is no float anywhere in the integer pipeline. Pages label each result as "JS Number-safe" or "above 2^53" so you know whether it is safe to paste into code that uses plain numbers.

Input policy

  • Maximum length: 4,096 significant digits. BigInt is exact at any size; the cap exists only to keep the page responsive while you type.
  • Bases: 2 through 36 (digits 0-9, then A-Z).
  • Prefixes: 0x or # for hexadecimal, 0b for binary, 0o for octal. A prefix that does not match the selected base is rejected with an explanation rather than silently reinterpreted.
  • Separators: spaces, underscores, and commas are accepted as visual grouping and ignored (1_024, ff ff, 1,024 all parse).
  • Validation: errors name the first invalid digit and its 1-based position, so a stray 8 in octal or a typo in a long value is easy to find.

Negative and signed numbers

A leading - (or +) sign is accepted before or after a base prefix. Representations keep the sign: -255 in hex is shown as -0xFF, the negative sign applied to the magnitude. Signed interpretation is a separate, explicit step: two's-complement views re-read the stored bit pattern at a fixed width instead of changing the value.

Two's-complement width rules

Signed views are available at 8, 16, 32, 64, 128 bits. At width w:

  • the unsigned range is 0 to 2^w - 1 and the signed range is -2^(w-1) to 2^(w-1) - 1 (for 64-bit: -9223372036854775808 to 9223372036854775807);
  • the signed view reads the top stored bit as the sign bit, so 0xFF is 255 unsigned but -1 signed at 8 bits;
  • a value inside either range is shown as-is; a value outside both is reduced modulo 2^w and clearly labeled truncated - the tool never silently drops high bits;
  • shift and mask tools saturate at the width boundary: shifting out past the width loses bits on one end and fills on the other, exactly like fixed-width hardware registers.

Where floating point is intentional

The IEEE-754 tool works with floats on purpose: its whole subject is the binary32 / binary64 floating-point format, including its rounding. Byte-unit and ratio calculators may also divide and produce fractional results. Those pages are about fractional or floating-point quantities; every integer conversion on the site remains exact.

Test strategy

The conversion engine is covered by a reference test suite (npm test, vitest) that runs in CI and before every deploy. It includes:

  • zero, leading zeros, signs, prefixes, and separators;
  • invalid digits (8/9 in octal, 2 in binary, G in hex) with exact positions;
  • values below, at, and far above 2^53, plus full 64/128/256-bit round-trips;
  • signed and two's-complement boundaries at every supported width (8/16/32/64/128 bits);
  • shift counts, mask bounds, and padding/truncation edge cases;
  • cross-checks against independent reference implementations written separately from the engine.

Examples shown on converter pages are generated by the same tested engine at render time, never hand-maintained strings.

Privacy

All computation happens in your browser. Product analytics record event types only (a conversion succeeded or failed, a copy button was used, a code tab was selected) and never include the numbers you enter or the results generated. Prefill links use a ?x= query parameter; result states are client-only and are never added to the sitemap or turned into crawlable URLs.

Questions or a correctness report? See the about page.