Home› Tools› Developer Tools› Decimal to Binary Converter
Real-time · Signed · IEEE 754

Decimal to Binary Converter — Signed, Fractions & IEEE 754

Quick answer: To convert a decimal number to binary, divide it by 2 and record each remainder (0 or 1). Read the remainders from bottom to top to get the binary result. The exact formula is binary = (decimal ÷ 2, collect remainders). For example, decimal 13 becomes binary 1101, and decimal 255 becomes 11111111.
By AIToolsPros Team 100% client-side · nothing uploaded Last updated: September 3, 2026 ~11 min read

Decimal ⇄ Binary Converter

Real-time. Bit grid visualizer. Signed 2's complement. IEEE 754.

DEC
1101
Binary (base 2)
1101
Hex (base 16)
D
Octal (base 8)
15
Signed 2's complement (32-bit)
00000000 00000000 00000000 00001101
Interactive bit grid — click bits to toggle = 13
IEEE 754 floating-point representation
Sign (1 bit) Exponent Mantissa

Powers of 2 — the value of each bit

Each active bit adds its power-of-2 value to the total. Bars in green are set to 1 in your current number.

Step-by-step division method

Divide by 2, record the remainder, repeat with the quotient. Read remainders from bottom to top to get the binary result.

DivisionQuotientRemainderBit #

How to use this decimal to binary converter

Type or paste a decimal number in the input field — the converter updates in real time as you type. It accepts positive integers, negative integers, decimals with fractional parts, and scientific notation such as 5.72e2. The output panel shows the value in binary, hexadecimal, octal, and signed two's complement at your chosen bit width. Below that, the bit-grid visualizer lets you click individual bits to see how each power of 2 contributes to the total.

Tap the circular swap icon to reverse direction and convert binary back to decimal. Change the bit width to see how the same number is stored as an 8-, 16-, 32-, or 64-bit integer, and switch grouping to break long binary strings into readable chunks of 4 or 8. Everything runs locally in your browser — nothing is uploaded, logged, or cached on a server.

What is decimal and what is binary?

Decimal is the base-10 numeral system. It uses ten symbols — 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 — and each position represents a power of 10. The number 653 means 6×10² + 5×10¹ + 3×10⁰. Humans use decimal because we have ten fingers.

Binary is the base-2 numeral system. It uses only two symbols — 0 and 1 — and each position represents a power of 2. The binary number 1101 means 1×2³ + 1×2² + 0×2¹ + 1×2⁰ = 8 + 4 + 0 + 1 = 13. Every digital computer stores and processes information in binary because it maps directly onto the two states of a transistor (on/off), which makes hardware simpler, faster and more reliable to build with logic gates (Calculator.net). Binary is the foundational language of computing — every image, sound, character and instruction in every device ultimately lives as a stream of ones and zeros.

The division-by-2 method (step by step)

The standard algorithm for converting decimal to binary is repeated division by 2. Divide the number by 2, record the remainder, replace the number with the quotient, and repeat until the quotient is 0. Read the remainders from bottom to top and you have the binary equivalent.

Convert 13 to binary ──────────────────── 13 ÷ 2 = 6 remainder 1 ← bit 0 (LSB) 6 ÷ 2 = 3 remainder 0 ← bit 1 3 ÷ 2 = 1 remainder 1 ← bit 2 1 ÷ 2 = 0 remainder 1 ← bit 3 (MSB) Read bottom → top: 1101₂ = 13₁₀

The step-by-step division table in the tool above updates live as you type, so you can watch this process play out for any number. The same idea, expressed algebraically, is bₖ = ⌊n ÷ 2ᵏ⌋ mod 2 — the k-th binary bit is the k-th binary digit of the number when the number is written in base 2 (RapidTables).

Alternative method: powers of 2 (subtraction)

An equally valid approach is the subtraction method, which works directly with the powers of 2 shown in the bit-grid visualizer:

  1. List the powers of 2 that are ≤ your decimal number: 1, 2, 4, 8, 16, 32, 64, 128 …
  2. Starting from the largest, subtract it from the number if possible; record a 1. Otherwise record a 0.
  3. Repeat with the remainder and the next smaller power of 2 until you reach 0.

For 13: the largest power of 2 ≤ 13 is 8 → subtract → remainder 5, record 1. Next is 4 → subtract → remainder 1, record 1. Next is 2 → too big, record 0. Next is 1 → subtract → remainder 0, record 1. Result: 1101. This method is often faster mentally for small numbers and is exactly what the interactive bit grid does when you click bits (Teleport).

Converting negative numbers: two's complement

Computers store negative numbers using two's complement, the near-universal representation for signed integers on modern CPUs (Wikipedia). The process for a chosen bit width is:

  1. Convert the absolute value to binary and pad with zeros to fill the bit width.
  2. Invert every bit (0 → 1, 1 → 0). This is the one's complement.
  3. Add 1. The result is the two's complement representation of the negative value.
Convert −5 to 8-bit two's complement ────────────────────────────────── Step 1 |5| → 00000101 Step 2 invert → 11111010 Step 3 add 1 → 11111011 Read as unsigned: 251 Read as signed 8-bit: −5

Because the same bit pattern can mean different things depending on how many bits the system uses, bit width is critical. The signed ranges below are the reason C uses int8_t, int16_t, int32_t and int64_t to make width explicit:

WidthSigned rangeUnsigned range
8-bit−128 to 1270 to 255
16-bit−32,768 to 32,7670 to 65,535
32-bit−2,147,483,648 to 2,147,483,6470 to 4,294,967,295
64-bit−9.22 × 10¹⁸ to 9.22 × 10¹⁸0 to 1.84 × 10¹⁹
Asymmetry gotcha: An 8-bit signed integer runs from −128 to 127, not −128 to 128 — the extra negative value exists because zero occupies one of the "positive" slots. This is why abs(INT_MIN) overflows in C.

Converting decimal fractions to binary

Fractional parts use the opposite algorithm — repeated multiplication by 2. Multiply the fractional part by 2 and record the integer digit that appears (0 or 1); then take the new fractional part and repeat until it reaches 0 or you hit your desired precision:

Convert 0.625 to binary ─────────────────────── 0.625 × 2 = 1.25 → bit 1 0.25 × 2 = 0.5 → bit 2 0.5 × 2 = 1.0 → bit 3 (done — remainder is 0) Result: 0.101₂

Fractions like 0.625 that terminate cleanly are called dyadic: their denominator is a power of 2. But most everyday decimals are not dyadic. 0.1 in binary is 0.0001100110011… repeating forever, because 10 (the denominator of 1⁄10) is not a power of 2. This is the root cause of the famous "0.1 + 0.2 ≠ 0.3" bug seen in JavaScript, Python and every other IEEE 754 language (ExploringBinary). Use the Fraction bits selector in the tool to control how many bits of precision to display for infinite fractions.

IEEE 754 — how real numbers actually live inside a computer

Fixed-point binary works for pure fractions, but computers need a way to store numbers of vastly different magnitudes — 0.000001 and 1,000,000,000 in the same 32 bits. The universal solution is IEEE 754 floating-point, which splits every real number into three parts: a sign bit, a biased exponent, and a mantissa (also called the significand):

FormatSignExponentMantissaTotalApprox precision
Single (binary32)1 bit8 bits23 bits32 bits~7 decimal digits
Double (binary64)1 bit11 bits52 bits64 bits~15–17 decimal digits

The value is reconstructed as (−1)ˢⁱᵍⁿ × 1.mantissa × 2^(exponent−bias), where the bias is 127 for single precision and 1023 for double precision (GeeksforGeeks). The color-coded IEEE 754 panel in the converter shows the sign, exponent and mantissa segments live for any number you type. JavaScript's Number, Python's float, C's double, Java's double and Rust's f64 are all IEEE 754 double precision.

Decimal to binary in every major programming language

Every mainstream language has a built-in decimal-to-binary conversion. The syntax differs but the result is identical to what this tool produces:

# Python bin(13) # '0b1101' bin(13)[2:] # '1101' format(13, '08b') # '00001101' (8-bit padded) // JavaScript (13).toString(2) // '1101' (13).toString(2).padStart(8, '0') // '00001101' ((-5) >>> 0).toString(2) // '11111111111111111111111111111011' // Java Integer.toBinaryString(13); // "1101" Integer.toBinaryString(-5); // "11111111111111111111111111111011" // C printf("%d\n", 13); // '13' (no %b in std C99) // C23 adds %b: printf("%b\n", 13); → "1101" // Go strconv.FormatInt(13, 2) // "1101" fmt.Sprintf("%b", 13) // "1101" // Rust format!("{:b}", 13) // "1101" format!("{:08b}", 13) // "00001101"

All of these produce unsigned binary for the magnitude. For a fixed-width two's complement view of a negative number, mask with the desired width (e.g. n & 0xFF for 8-bit) before formatting.

Decimal, binary, hex & octal conversion table (0 – 32)

The go-to reference table for the first 32 non-negative integers, plus common power-of-2 milestones. Highlighted rows are the powers of 2:

DecimalBinaryHexOctal
0000
1111
21022
31133
410044
510155
611066
711177
81000810
91001911
101010A12
111011B13
121100C14
131101D15
141110E16
151111F17
16100001020
17100011121
18100101222
19100111323
20101001424
24110001830
31111111F37
321000002040
64100000040100
100110010064144
1281000000080200
20011001000C8310
25511111111FF377
256100000000100400
51210000000002001000
1024100000000004002000
65,5351111111111111111FFFF177777

Powers of 2 reference

Every binary bit is a power of 2 — memorizing the first dozen is a lifetime cheat code for developers, network engineers, and anyone doing capacity planning:

n2ⁿCommon meaning
01
12
38byte (8 bits)
7128
8256values in a byte
101,024kilo (KiB)
1665,53616-bit unsigned max + 1
201,048,576mega (MiB)
301,073,741,824giga (GiB)
324,294,967,29632-bit unsigned max + 1 (IPv4 space)
40~1.1 × 10¹²tera (TiB)
64~1.8 × 10¹⁹64-bit unsigned max + 1

Where developers use decimal ⇄ binary every day

  • Networking & subnetting. IPv4 addresses like 192.168.1.1 live as 32-bit binary; subnet masks work bit-by-bit.
  • Bit flags and permissions. Unix file modes (chmod 755), feature flags, and enum bitfields pack many booleans into a single integer.
  • Low-level programming. Embedded firmware, drivers, and OS kernels manipulate hardware registers bit by bit.
  • Cryptography. XOR, bit shifts, and modular arithmetic on binary values underlie every cipher.
  • Data compression & encoding. Huffman codes, Base64, UTF-8 all operate on binary patterns.
  • Debugging floating-point bugs. Understanding IEEE 754 binary is the fastest way to explain "why doesn't 0.1 + 0.2 equal 0.3?"
  • Graphics & games. Color values (RGBA), texture packing, and depth buffers are binary-native.

A quick history of binary

The binary system was formally described by the German polymath Gottfried Wilhelm Leibniz in his 1703 manuscript Explication de l'Arithmétique Binaire, though the idea has independent roots as far back as the ancient Chinese I Ching and the work of Thomas Harriot in the late 1500s (Wikipedia, ACM). Leibniz also invented hexadecimal and dreamed of a mechanical calculator that would work in binary — an idea only realized centuries later.

Binary became the language of computing in the 1930s and 1940s. Claude Shannon's 1937 master's thesis proved that Boolean algebra — a branch of logic developed by George Boole in the 1850s — could be implemented with electrical relays, giving engineers the mathematical toolkit to build digital circuits. Every microprocessor since ENIAC has been, at heart, a very fast machine for adding, subtracting, and comparing binary numbers.

Frequently asked questions

How do I convert a decimal number to binary?

Divide the decimal number by 2, record the remainder (0 or 1), replace the number with the quotient, and repeat. When the quotient hits 0, read the remainders from bottom to top. Decimal 13 gives remainders 1, 0, 1, 1 → read up → 1101.

What is 10 in binary?

Decimal 10 = 1010 in binary, A in hex, 12 in octal. It equals 8 + 2, so bits 3 and 1 are set.

What is 255 in binary?

Decimal 255 = 11111111 in binary — eight ones. It's the largest value in an 8-bit unsigned integer and equals FF in hex.

How do you convert a negative decimal number to binary?

Use two's complement: convert the absolute value, pad to your bit width, invert every bit, then add 1. In 8-bit, −5 becomes 11111011.

What is the range of an 8-bit, 16-bit, 32-bit and 64-bit signed integer?

8-bit: −128 to 127. 16-bit: −32,768 to 32,767. 32-bit: −2,147,483,648 to 2,147,483,647. 64-bit: −9.22 × 10¹⁸ to 9.22 × 10¹⁸.

How do you convert a decimal fraction to binary?

Multiply the fractional part by 2, record the integer digit (0 or 1), repeat with the new fractional part until it reaches 0 or you hit your desired precision.

Why is 0.1 in binary a repeating fraction?

0.1 in decimal has no exact binary representation because 10 is not a power of 2. In binary it becomes 0.0001100110011… repeating forever. This is why 0.1 + 0.2 does not exactly equal 0.3 in IEEE 754 arithmetic.

How does IEEE 754 store decimal numbers in binary?

IEEE 754 uses a sign bit, a biased exponent, and a mantissa. Single precision is 1 + 8 + 23 bits (32 total, ~7 decimal digits). Double precision is 1 + 11 + 52 bits (64 total, ~15–17 decimal digits).

How do I convert decimal to binary in Python?

Use the built-in bin(13) which returns '0b1101'. Use bin(13)[2:] or format(13, 'b') to drop the prefix, or format(13, '08b') for zero-padded 8-bit output.

How do I convert decimal to binary in JavaScript?

Call (13).toString(2), which returns the string '1101'. For a fixed 8-bit width, use (13).toString(2).padStart(8, '0'). For a negative number as unsigned 32-bit, use ((-5) >>> 0).toString(2).

Sources & methodology

  • RapidTables — Decimal to Binary Conversion — rapidtables.com
  • Wikipedia — Two's complement — wikipedia.org
  • GeeksforGeeks — IEEE Standard 754 Floating-Point Numbers — geeksforgeeks.org
  • ExploringBinary — Arbitrary-precision decimal/binary converter — exploringbinary.com
  • Teleport — Decimal-to-Binary Converter guide — goteleport.com
  • MDN — Number.prototype.toString — developer.mozilla.org

Integer conversion uses JavaScript's native BigInt for arbitrary precision. Two's complement is computed as (~n + 1) & mask for the selected bit width. Fractional conversion uses repeated multiplication by 2, truncated at the chosen precision (an ellipsis "…" marks non-dyadic infinite expansions). IEEE 754 bits come from DataView.setFloat32 / setFloat64.

On this page

  1. Converter tool
  2. Powers-of-2 chart
  3. Division steps
  4. How to use it
  5. Decimal & binary defined
  6. Division-by-2 method
  7. Powers-of-2 method
  8. Two's complement
  9. Fractions
  10. IEEE 754 explained
  11. Programming code
  12. Conversion table
  13. Powers of 2
  14. Use cases
  15. History
  16. FAQ
  17. Sources
Skip to content
AI Tools Pros Free · Private · Instant
  • Home
  • Blog
  • About Us
  • Contact
Tool Navigator 148 free tools · 0 uploads
/
All tools

Calculators

32 tools · Everyday math, health & finance

Browse all
Age CalculatorFree · Browser based Matrix CalculatorFree · Browser based Fraction CalculatorFree · Browser based Sales Tax CalculatorFree · Browser based LCM CalculatorFree · Browser based Grade CalculatorFree · Browser based Average CalculatorFree · Browser based GCF CalculatorFree · Browser based Date CalculatorFree · Browser based Day of the YearFree · Browser based ERA CalculatorFree · Browser based Ohm’s Law CalculatorFree · Browser based Pet Age CalculatorFree · Browser based Degrees ↔ RadiansFree · Browser based Week Number CalculatorFree · Browser based Percentage CalculatorFree · Browser based Tip CalculatorFree · Browser based Discount CalculatorFree · Browser based Birthday CountdownFree · Browser based Volume CalculatorFree · Browser based Proportion CalculatorFree · Browser based Salary → HourlyFree · Browser based TrigonometryFree · Browser based Pythagorean TheoremFree · Browser based Percentage IncreaseFree · Browser based Mean, Median, ModeFree · Browser based Prime Number CheckerFree · Browser based Body Fat (Army)Free · Browser based Area of a TrapezoidFree · Browser based Decimal → FractionFree · Browser based Area CalculatorFree · Browser based BMI CalculatorFree · Browser based

Text Tools

15 tools · Count, convert & clean text

Browse all
Word CounterFree · Browser based Case ConverterFree · Browser based Paraphrasing ToolFree · Browser based Sentence CounterFree · Browser based Letter CounterFree · Browser based Spacebar CounterFree · Browser based Tap CounterFree · Browser based I or L CheckerFree · Browser based Haiku CheckerFree · Browser based Fragment / SentenceFree · Browser based Word → Phone NumberFree · Browser based Line CounterFree · Browser based Character CounterFree · Browser based Characters → WordsFree · Browser based AI Text SummarizerFree · Browser based

Developer

14 tools · Encoding, parsing & utilities

Browse all
Password GeneratorFree · Browser based Base64 Encoder / DecoderFree · Browser based Character IdentifierFree · Browser based Byte CounterFree · Browser based Gray Code → HexFree · Browser based Hex + CalculatorFree · Browser based Hex → ASCIIFree · Browser based Hex → DecimalFree · Browser based Decimal → BCDFree · Browser based Base ConverterFree · Browser based UUID GeneratorFree · Browser based URL Encoder / DecoderFree · Browser based HTML Entity EncoderFree · Browser based Decimal → BinaryFree · Browser based

Image Studio

18 tools · Resize, retouch & convert

Browse all
Grayscale ConverterFree · Browser based Image DownscalerFree · Browser based Image Quality ChangerFree · Browser based Manual Background RemoverFree · Browser based Glitch Image MakerFree · Browser based Image Filter StudioFree · Browser based Photo Timestamp AdderFree · Browser based Photo → ASCII ArtFree · Browser based Random Image GeneratorFree · Browser based Side-by-Side CollageFree · Browser based Image ResizerFree · Browser based JPG → PNGFree · Browser based Compress PNGFree · Browser based Image File Size CheckerFree · Browser based Background ChangerFree · Browser based Background RemoverFree · Browser based Image PixelatorFree · Browser based Vectorize PictureFree · Browser based

Generators

11 tools · Random picks & instant makers

Browse all
YouTube Thumbnail DownloaderFree · Browser based Random Birthday GeneratorFree · Browser based Random Name PickerFree · Browser based Random Group GeneratorFree · Browser based Random PickerFree · Browser based Random Number PickerFree · Browser based YouTube TranscriptFree · Browser based Minecraft CircleFree · Browser based Instagram DM GeneratorFree · Browser based Scatter Plot MakerFree · Browser based Slug GeneratorFree · Browser based

Unit Converters

25 tools · Length, weight, data & more

Browse all
Feet & Inches → CMFree · Browser based Grams → PoundsFree · Browser based Ounces → CupsFree · Browser based MB → KBFree · Browser based KB → MBFree · Browser based KB → GBFree · Browser based MB → GBFree · Browser based GB → MBFree · Browser based GB → TBFree · Browser based TB → GBFree · Browser based TB → MBFree · Browser based MB → BytesFree · Browser based Bytes → MBFree · Browser based Yards → MilesFree · Browser based M → Nautical MileFree · Browser based Length ConverterFree · Browser based IN → MMFree · Browser based HA → AcreFree · Browser based HR → YRFree · Browser based OZ → Troy OZFree · Browser based Fahrenheit → CelsiusFree · Browser based FPS → MPHFree · Browser based OZ → PoundsFree · Browser based Stone → PoundsFree · Browser based Gallons → LitersFree · Browser based

Time & Date

22 tools · Dates, timezones & countdowns

Browse all
Average Time CalculatorFree · Browser based Zodiac Sign CalculatorFree · Browser based Days → HoursFree · Browser based Date → WordsFree · Browser based Time AdditionFree · Browser based Analog Clock GeneratorFree · Browser based EST → CSTFree · Browser based Hours → DaysFree · Browser based Military TimeFree · Browser based Free Timecard CalculatorFree · Browser based CDT → ESTFree · Browser based PDT → MSTFree · Browser based EDT → CSTFree · Browser based PDT → UTCFree · Browser based 30 Days From TodayFree · Browser based 45 Days From TodayFree · Browser based 60 Days From TodayFree · Browser based 90 Days From TodayFree · Browser based 180 Days From TodayFree · Browser based Months CalculatorFree · Browser based Week CalculatorFree · Browser based Zodiac Signs ListFree · Browser based

Audio Lab

7 tools · Tones, BPM & recording

Browse all
Tone GeneratorFree · Browser based BPM Tap CounterFree · Browser based Mic TestFree · Browser based Voice RecorderFree · Browser based Binaural Beats GeneratorFree · Browser based Noise GeneratorFree · Browser based BPM DetectorFree · Browser based

Video Tools

3 tools · Record, trim & test

Browse all
Screen RecorderFree · Browser based Video TrimmerFree · Browser based Webcam TestFree · Browser based

Downloaders

1 tools · Grab images & media

Browse all
Image Extractor from LinkFree · Browser based

No tools found

Try a different keyword, or browse all tools.

10 categories 148+ free tools
Explore all tools
Explore Tools
AI Tools Pros
Home Blog About Us Contact
Explore All Tools

Recent Posts

  • How to Resize Images Without Losing Quality: Full Guide
  • How to Write the Date in English: US vs British Format, Letters & Examples (2026)
  • Is KB Bigger Than MB? KB vs MB Explained (with File Size Chart)
  • How to Test Your Mic: Complete Guide for Mac, Windows & PC (2026)
  • Is Grok Free? How to Use Grok AI for Free in 2026 (Limits, Pricing & Hacks)

Recent Comments

  1. Xiaolou on 60+ ChatGPT Image Prompts for Photo Editing, Portraits & More
  2. Muhammad Waqas on 25+ Best Gemini AI Photo Prompts for 2026 (Copy-Paste Nano Banana Prompts for Professional, Cinematic & Trending Edits)
  3. Lili Chen on 60+ ChatGPT Image Prompts for Photo Editing, Portraits & More
  4. Prime Bonex on ChatGPT Prompts for Writers: 100+ Copy-Paste Prompts

Archives

  • October 2026
  • September 2026
  • August 2026

Tools section 1

Age calculator
Percentage Calculator
Tip Calculator
Discount Calculator
Password Generator

Base 64 Encoder Decoder
URL Encoder & Decoder
HTML Entity Encoder & Decoder

Tools section 2

UUID Generator
YouTube Thumbnail Downloader
BLI Calculator
Screen Recorder
Video Trimmer
Webcam Test
Image Resizer
Automatic Background Remover
BPM Tap Counter

Tools section 3

Manual Background Remover
URL Slug Generator
Text Case Converter
Character Counter
Word Counter
Voice Recorder
Online Tone Generator
Binaural Beats Generator
Noise Generator

Scroll to Top

Powered by
►
Necessary cookies enable essential site features like secure log-ins and consent preference adjustments. They do not store personal data.
None
►
Functional cookies support features like content sharing on social media, collecting feedback, and enabling third-party tools.
None
►
Analytical cookies track visitor interactions, providing insights on metrics like visitor count, bounce rate, and traffic sources.
None
►
Advertisement cookies deliver personalized ads based on your previous visits and analyze the effectiveness of ad campaigns.
None
►
Unclassified cookies are cookies that we are in the process of classifying, together with the providers of individual cookies.
None
Powered by