base-converter
Type a number in binary, octal, decimal, or hexadecimal and see it instantly converted to all four bases at once. Built on BigInt, so full 64-bit values (like a C# long) convert exactly — no floating-point precision loss.
// how input is read
// why this handles 64-bit values correctly
Every conversion here uses JavaScript's BigInt rather than Number. A plain Number can only represent integers exactly up to 2^53 - 1 (Number.MAX_SAFE_INTEGER), but a C# long / ulong ranges up to 2^63 - 1 / 2^64 - 1 — well past that safe limit. Converting a large 64-bit value through Number silently rounds it to the nearest representable double, producing a wrong answer with no error. BigInt has arbitrary precision, so values like long.MaxValue (9223372036854775807) or ulong.MaxValue (18446744073709551615) round-trip exactly across all four bases.
// where each base shows up in .NET / backend work
- Binary — bit flags and
[Flags]enums, bitmasks, permission bits, low-level protocol fields. - Octal — Unix file permission modes (
chmod 644), some legacy embedded/serial protocols. - Decimal — everyday application values, IDs, counts — what you see in a debugger by default.
- Hexadecimal — memory addresses, GUIDs, color codes, hash digests, and compact display of binary data (two hex digits per byte).
Pick the base your typed digits are in using the radio buttons above the input — this is deliberately explicit rather than guessed, since a string like
10means very different things depending on whether it's binary (2), octal (8), decimal (10), or hex (16). If you paste a value with an explicit prefix —0x/0Xfor hex,0b/0Bfor binary, or0o/0Ofor octal — that prefix always wins over whatever base is selected, so pasting0xFFwhile "Decimal" is selected still reads as hex.