DEC2BIN Function in Excel: Decimal to Binary

DEC2BIN Function in Excel: Decimal to Binary featured illustration

πŸ“Ž This article includes 1 downloadable practice file ↓

⏱ 2 min readUpdated 28 September 2026

EngineeringLevel: IntermediateAvailable in: Excel 2007+

In this article
  1. Syntax
  2. Examples
  3. Example 1
  4. Common errors and fixes
  5. DEC2BIN in practice
  6. Where you will use it
  7. Worked example
  8. Mistakes people make
  9. Related functions
  10. Continue learning

DEC2BIN converts a number to binary text. Good for teaching, flags and subnet masks, but it only handles βˆ’512 to 511.

Advertisement

Syntax

=DEC2BIN(number, [places])
Argument What it means
places Pad with leading zeros.

Examples

Example 1

=DEC2BIN(13, 8)

Returns 00001101.

Common errors and fixes

You see Why, and the fix
#NUM! Number outside βˆ’512…511. Use BASE(n, 2) for bigger values.

DEC2BIN in practice

Where you will use it

  • Show numbers as binary for bit flags
  • Teaching number systems
  • Check subnet masks

Worked example

NumberFormulaResult
5=DEC2BIN(A2,8)00000101
10=DEC2BIN(A3,8)00001010
255=DEC2BIN(A4,8)11111111

Results calculated in Excel.

Mistakes people make

MistakeWhat to do instead
Numbers above 511DEC2BIN handles -512 to 511; use BASE for bigger numbers
Missing paddingThe second argument pads with zeros

BIN2DEC Β· DEC2HEX Β· BASE

πŸ“š Part of the free Excel course: Beginner β†’ Expert Β· Try it in the Formula Lab or ask the AI Helper.

⚑ Interactive Practice Lab & Formula Tester:

Test formulas dynamically in our web formula laboratory or download the companion Excel workbook.

πŸ“Ž Practice files for this article

  • πŸ“—
    Practice workbook: Engineering & conversion15 tasks on realistic sales data β€” type your formula, the Check column turns green when it is right. Answers sheet included.
    ⬇ XLSX Β· 34 KB

Free to use for learning. Files with macros (.bas) are plain text β€” import them with Alt+F11 β†’ File β†’ Import File, and always test on a copy.

✨ Ask AI about this article

Stuck on a step? Ask a question and the AI answers using this article.

Free Β· AI can be wrong