Binary Converter
Convert a decimal number to binary and a binary number back to decimal.
Supports 4–64-bit signed representations with two's complement for negative values.
Updated August 11, 2026
Introduction / overview
Binary Converter translates a decimal integer into its fixed-width binary pattern and back again. You pick the representation — 4, 8, 12, 16, 32, or 64 bits, or a custom size — and the tool produces the exact bit pattern, including the part people usually stumble on: how negative numbers are stored.
The two directions are separate converters that share the bit-width setting. Type a decimal in “Decimal to binary” and read the padded pattern below it; type a binary string in “Binary to decimal” and read its decimal value below that.
It is the tool to reach for when you need to know exactly how a value such as fits into eight bits — whether you are studying number systems, checking a bit pattern in a microcontroller register, decoding a value from a file format, or working out octets for IP addresses. Because every conversion is exact, the pattern you see is the pattern a real -bit register would hold.
How to use / quick start
Choose the bit width
Pick a preset such as 8-bit or 16-bit from Binary number representation. For a size that is not listed, choose Other and type the number of bits (anywhere from 2 to 70).
Convert decimal to binary
In Decimal to binary, type a whole decimal number. The result below shows the pattern padded to the full width, with the caption telling you the representation (for example, “Number in 8-bit representation.”).
Convert binary to decimal
In Binary to decimal, type a string of 0s and 1s — leading zeros are optional. Positive values give a single Decimal result. When the leftmost bit is 1 the value is negative, so the calculator shows both the 1’s complement and 2’s complement readings of that same pattern.
Example 1 — convert 3 to 8-bit binary
Type in the Decimal field. The calculator expands it by place value, then pads the two-bit result out to the full width:
So the Binary result reads 0000 0011, and the caption confirms it is an 8-bit representation.
Example 2 — a negative value, −87 in 8 bits
Type in the Decimal field. Because the value is negative, the tool encodes it with two’s complement: take the pattern for , flip every bit, then add 1.
The Binary result shows 1010 1001. As an unsigned number that pattern equals ; as a signed two’s-complement value it equals .
Calculation method
Every bit in the pattern carries a power of two. For bits, the leftmost bit is position and the rightmost is position 0:
Decimal to binary (two’s complement)
Binary to decimal (two’s complement)
1’s complement reading of a pattern with a leading 1
Variables
- — the decimal value you enter or read
- — the unsigned value of the -bit pattern
- — the number of bits (2 to 70)
- — the bit at position (0 or 1)
Where the limits come from
With bits you can represent exactly patterns. A signed -bit integer therefore runs from up to . A decimal outside that range triggers the “not in the workable range” error, and a binary string whose value reaches needs more than bits and is reported as too long.
Frequently asked questions
Why does 1111 1111 (8-bit) show 0 for 1’s complement and −1 for 2’s complement?
Because the pattern equals as an unsigned number. One’s complement subtracts , giving (the “negative zero” this scheme has). Two’s complement subtracts , giving .
Do I have to type the leading zeros?
No. Type and the result pads it to the selected width — for 8-bit you get 0000 0001. The calculator only cares about the value, not how many digits you wrote.
Why do I get “not in the workable range” or “too long”?
“Not in the workable range” means the decimal value does not fit the signed range for the chosen width (for example, is too large for 8-bit signed, which tops out at ). “Too long” means the binary string has more digits than the selected width allows. In both cases, switch to a larger representation such as 16-bit.
Limitations
This calculator works with whole numbers only: the Decimal field accepts integers, and the Binary field accepts only the digits 0 and 1. The bit width is limited to 2–70 bits, and values must fit the signed range of the selected width — a decimal must fall within to , and a binary string must need no more than digits. Conversions are exact, so results are never rounded, but they always include the leading zeros needed to fill the chosen width. For fractional numbers, other numeral systems such as octal or hexadecimal, or bases beyond 2, use a dedicated base converter instead.
Related Calculators
Scale Calculator
Calculate scale factors and convert scaled or real dimensions for length, area, and volume.
Text to ASCII binary
Convert text to ASCII (8-bit) binary and convert ASCII binary back to text. Clean input automatically and copy results instantly.
Text to Unicode
Convert text to Unicode decimal HTML entities (e.g., A) and convert them back to text. Runs locally in your browser with one-click copy.
Integer Base Converter
Convert an integer between bases 2–64 (binary, octal, decimal, hexadecimal, base64, and custom). Runs locally in your browser.
IPv4 address converter
Convert an IPv4 address into decimal, binary, hexadecimal, and IPv4-mapped IPv6 representations. Runs locally in your browser with one-click copy.
Fraction to Percent Calculator
Convert fractions to percentages and vice versa instantly