Number Base Converter — Convert Between Decimal, Hex, Binary, Octal
Convert numbers between decimal, hexadecimal, binary, and octal. Auto-detects input format, live preview — runs in your browser, no upload.
Number Base Converter
Convert numbers between decimal, hexadecimal, binary, and octal. Auto-detects input format — supports 0x, 0b, 0o prefixes. Also shows UInt/Int and ASCII values. Works entirely in your browser.
Every developer who has ever stared at a hex dump, a binary mask, or an octal permission set knows the mental friction of converting between number bases. The hex value 0x7F is a character code (DEL in ASCII), a bitmask (01111111), and the decimal number 127 — but you only think of it in the base you are working in, and switching bases means stopping to do arithmetic. The number base converter eliminates that friction by showing all four representations simultaneously and updating them in real time as you type.
The auto-detection is what makes the tool faster than a calculator. Paste a hex value from a network trace and the tool recognises the 0x prefix and shows the decimal equivalent instantly. Paste a binary string from a bitmask debugger and the hex and decimal equivalents appear without a mode switch. The tool is designed for the workflow where the input format is not known in advance — the value comes from a log line, a debugger watchpoint, or a config file, and you need to see it in the format that makes sense for the task at hand.
The binary grouping in nibbles is a small detail that makes a large difference. A 32-bit binary string like 11111111111111111111111111111111 is unreadable as a flat string of 32 characters. Grouped as 1111 1111 1111 1111 1111 1111 1111 1111, the hex equivalent 0xFFFFFFFF becomes obvious by inspection — each nibble maps to exactly one hex digit. The tool applies this grouping automatically for binary outputs of 8 bits or more, which makes the output scannable rather than inscrutable.
How to use
Enter a number
Type a number in any supported base: decimal (42), hex (2A or 0x2A), binary (101010 or 0b101010), or octal (52 or 0o52). The tool auto-detects the input base from prefix notation or digit set.
Read all four representations
The output panel shows the number in decimal, hex, binary, and octal simultaneously. Each representation updates in real time as you type. The binary output is grouped in nibbles (4-bit chunks) for readability.
Copy any representation
Click the copy button next to any base to copy that specific representation. The decimal value is copied as a plain number, hex with the 0x prefix, binary with the 0b prefix, and octal with the 0o prefix.
Frequently asked
How does the auto-detect work for ambiguous inputs?
The tool checks for explicit prefixes first (0x for hex, 0b for binary, 0o for octal). Without a prefix, it inspects the digit set: letters A-F indicate hex, only 0s and 1s suggest binary if the length is a multiple of 4 or 8. If still ambiguous (e.g., '10' could be decimal, hex, binary, or octal), decimal is the default.
Does it support floating-point numbers?
No. The converter handles integers in the safe integer range (up to 2^53-1 in JavaScript). Floating-point numbers and fractional representations (hex floats, binary fractions) are not supported. For IEEE 754 floating-point conversion, use a dedicated binary-float tool.
Can I enter negative numbers?
Yes. Prefix a number with a minus sign for decimal. For hex, binary, and octal, the minus sign is interpreted as a negative value in the auto-detected base. Two's complement is not applied — the output is the simple integer value of the negated magnitude.
What is the maximum input value?
Up to 9,007,199,254,740,991 (Number.MAX_SAFE_INTEGER in JavaScript, 2^53-1). For larger integers that require BigInt semantics — common in cryptography, blockchain work, and some database IDs — use a command-line tool like bc or Python's int type.
Why would I use this instead of a calculator app?
A calculator app shows one base at a time. This tool shows all four simultaneously and updates in real time as you type, which is the right workflow for debugging a hex value from a network trace while cross-referencing the binary bit pattern and the decimal ID it represents.
Limitations
- Integers onlyFractional values, scientific notation, and floating-point hex representations are not supported. Inputs containing a decimal point are rejected.
- No BigInt supportValues beyond 2^53-1 are rounded or rejected. For cryptographic or database IDs above this range, use a CLI tool with arbitrary-precision integer support.
- No bitwise operation viewThe converter shows the number in four bases but does not provide a bitwise view (flip bits, shift, AND/OR/XOR). For bitwise operations, use a programmer's calculator like the one built into macOS Calculator in Programmer mode.
Platform notes
- macOS
- macOS Calculator in Programmer mode (Cmd+3) does the same conversion. The browser tool is the right pick for multi-base display side by side with a hex dump or a debugger.
- Linux
- For command-line work, `printf '%x\n' 42` and `echo $((16#2A))` handle one-off conversions. The browser tool shows all four bases simultaneously.
- Web
- Runs entirely client-side. No input leaves the browser.