How to convert between number bases
- Select the base used by the input: decimal, binary, octal or hexadecimal.
- Paste one integer. You may include a leading plus or minus sign.
- Select Convert integer to see the same value in all four bases.
- Copy the JSON report or download base-conversion.json. Each representation is a string to preserve every digit.
Only surrounding whitespace is trimmed. Grouping spaces, commas, underscores and fractional points inside a value are rejected, so a partially valid input is never silently accepted.
Binary, octal, decimal and hexadecimal
A base specifies the place-value multiplier and allowed digits. Binary uses 0 and 1; octal uses 0 through 7; decimal uses 0 through 9. Hexadecimal adds a through f for digit values ten through fifteen. Uppercase hexadecimal input is accepted, and output uses lowercase.
The number’s value stays the same when the notation changes. This is useful when reading a bit mask in documentation, converting a hexadecimal identifier to a decimal field, or checking an octal quantity. It does not translate text encodings, Base64 or arbitrary byte sequences into human language.
Number conversion examples
Input
Decimal input: 255
Result
Binary: 11111111 Octal: 377 Decimal: 255 Hexadecimal: ff
For another direction, choose hexadecimal and enter 0xff; the results represent the same value. Decimal -10 becomes binary -1010, octal -12 and hexadecimal -a. A decimal input of 9007199254740993 becomes hexadecimal 20000000000001 without losing the final unit.
Exact integers and prefix handling
The processor validates every character before constructing a BigInt. It then uses integer conversion for each supported radix, avoiding the floating-point rounding that can occur with ordinary JavaScript Number values. Leading zeros do not change the mathematical value and are omitted from the result, except that zero itself is displayed as 0.
Prefixes are optional and must match the selected base: 0b for binary, 0o for octal and 0x for hexadecimal. A decimal input beginning with 0x is rejected rather than silently switching bases. A sign comes before a prefix, as in -0xff. Negative zero normalizes to zero.
Signed values, bit widths and unsupported input
Negative output uses a minus sign. It is not a fixed-width two’s-complement bit pattern, so -1 is shown as -1 rather than an assumed sequence of eight, sixteen or thirty-two one bits. To interpret a machine register, first establish its bit width and signedness in the source system.
Input is limited to 4,096 digits. Fractions, scientific notation, separators and bases other than 2, 8, 10 and 16 are not supported. The word ff is meaningful in hexadecimal but invalid in decimal. Unicode digit lookalikes are not treated as ASCII digits. This deliberate strictness helps reveal mistakes in copied values.
Related representations
For an epoch value whose meaning is a date, use the Unix Timestamp Converter. For a hexadecimal RGB color, use Color Converter, which interprets channels rather than a general integer. Base64 encoding works on bytes, so it is a different operation from expressing one integer in another base.
When moving a long decimal result into JSON or a spreadsheet, preserve it as text if the destination cannot represent large integers exactly. A correct conversion can still be rounded later by another application.
Exact integers instead of floating point
Conversion uses arbitrary-precision integers, so values above JavaScript's safe integer limit keep every digit. The converter reports binary, octal, decimal and hexadecimal forms of the same signed integer. It does not round, and it does not silently switch to exponential notation.
Only whole numbers are accepted. Fractions, digit separators, exponents and non-ASCII digits are rejected because they would require an interpretation the tool does not provide. Leading zeros are allowed on input and removed in the canonical output.
Prefixes, signs and negative values
A 0b, 0o or 0x prefix must match the selected input base; a mismatched prefix is an error rather than an invitation to guess. A minus sign before the value produces a negative number in every output. Negative values use a sign and magnitude, not fixed-width two's complement, so a bit pattern for a specific word size must be produced separately.
Check the digit set for the chosen base: binary accepts only 0 and 1, octal 0–7, decimal 0–9 and hexadecimal 0–9 plus a–f. The 4,096-digit input limit is generous for identifiers and flags but not intended for arbitrary-precision arithmetic.
Processing and privacy
Number Base Converter converts the integer in page memory; the value is not uploaded to a calculation service. Input stays in browser memory until you reset or leave the page. Copy and download run only when you choose them. No tool input is sent to a processing service. Website pages and scripts still make ordinary hosting requests; the privacy policy separates those from tool processing.
Frequently asked questions
Can I convert numbers above 2^53 − 1?
Yes, within the input limit. BigInt preserves the integer exactly, and the exported representations are strings.
Why is a negative binary result written with a minus sign?
No bit width was specified. The tool uses signed mathematical notation rather than assuming a two’s-complement register size.
Does this convert fractional numbers?
No. This tool accepts integers only; decimal points and exponent notation are rejected.
Can I convert fractional or negative values?
Integers only, including negative integers. Fractions and exponents are rejected.
Why is my 0x value rejected in decimal mode?
The prefix must match the selected input base. Choose hexadecimal or remove the prefix.
How this tool was checked
Number Base Converter was checked with integers beyond the safe range, signs before prefixes, leading zeros, invalid digits for the selected base and negative zero. See the testing method or report a failure.