(Looking to convert to *binary floating-point*? Try my floating-point converter.)

(Looking to *calculate* with binary numbers? Try my binary calculator.)

## About the Decimal/Binary Converter

This is a *decimal to binary* and *binary to decimal* converter. It’s different than most decimal/binary converters, like Google calculator or Windows calculator, because:

- It can convert fractional as well as integer values.
- It can convert very large and very small numbers — up to hundreds of digits.

Decimal numbers are converted to “pure” binary numbers, not to computer number formats like two’s complement or IEEE floating-point binary.

Conversion is implemented with arbitrary-precision arithmetic, which gives the converter its ability to convert numbers bigger than those that can fit in standard computer word sizes (like 32 or 64 bits).

## How to Use the Decimal/Binary Converter

### Input

- Enter a positive or negative number with no commas or spaces, not expressed as a fraction or arithmetic calculation, and not in scientific notation. Fractional values are indicated with a radix point (‘.’,
*not*‘,’) - Change the number of bits you want displayed in the binary result, if different than the default (applies only when converting a fractional decimal value).
- Click ‘Convert’ to convert.
- Click ‘Clear’ to reset the form and start from scratch.

If you want to convert another number, just type over the original number and click ‘Convert’ — there is no need to click ‘Clear’ first.

### Output

Besides the converted result, the number of digits in both the original and converted numbers is displayed. For example, when converting decimal 43.125 to binary 101011.001, the number of digits is displayed as ‘2.3 to 6.3’. This means that the decimal input has 2 digits in its integer part and 3 digits in its fractional part, and the binary output has 6 digits in its integer part and 3 digits in its fractional part.

Fractional decimal values that are dyadic convert to finite fractional binary values and are displayed in full precision. Fractional decimal values that are non-dyadic convert to infinite (repeating) fractional binary values, which are truncated — not rounded — to the specified number of bits. In this case, an ellipsis (…) is appended to the end of the binary number, and the number of fractional digits is noted as infinite with the ‘∞’ symbol.

## Exploring Properties of Decimal/Binary Conversion

The converter is set up so that you can explore properties of decimal to binary and binary to decimal conversion. You can copy the output of the decimal to binary converter to the input of the binary to decimal converter and compare the results (be sure not to copy the ‘…’ part of the number — the binary converter will flag it as invalid.)

A decimal integer or dyadic fractional value converted to binary and then back to decimal matches the original decimal value; a non-dyadic value converts back only to an approximation of its original decimal value. For example, 0.1 in decimal — to 20 bits — is 0.00011001100110011001 in binary; 0.00011001100110011001 in binary is 0.09999942779541015625 in decimal. Increasing the number of bits of precision will make the converted number closer to the original.

You can study how the number of digits differs between the decimal and binary representations of a number. Large binary integers have about log_{2}(10), or approximately 3.3, times as many digits as their decimal equivalents. Dyadic decimal fractions have the same number of digits as their binary equivalents. Non-dyadic decimal values, as already noted, have infinite binary equivalents.

## Other Arbitrary-Precision, Fractional Value Converters

Here’s a good converter to use if you want to display repeating fractional parts with “bar” notation; for example, 0.1_{10} converts to 0.00011_{2}. (This converter also converts between bases other than binary and decimal.)