HEX2DEC Function in Excel: Hexadecimal to Decimal

HEX2DEC Function in Excel: Hexadecimal to Decimal 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. HEX2DEC in practice
  5. Where you will use it
  6. Worked example
  7. Mistakes people make
  8. Related functions
  9. Continue learning

HEX2DEC reads hex text — colour codes, error codes from logs — as a number.

Advertisement

Syntax

=HEX2DEC(number)
Argument What it means
number Up to 10 hex characters.

Examples

Example 1

=HEX2DEC(MID(A2,2,2))

Red channel from a colour like #FF8000 (255).

HEX2DEC in practice

Where you will use it

  • Read colour codes as numbers
  • Decode hex IDs from logs
  • Convert meter readings

Worked example

HexFormulaResult
FF=HEX2DEC(A2)255
1A3F=HEX2DEC(A3)6719
FFFFFFFFFF=HEX2DEC(A4)-1

Results calculated in Excel.

Mistakes people make

MistakeWhat to do instead
10 hex digits starting with FThese are negative (two's complement)
0x prefixRemove it first

DEC2HEX · DECIMAL

📚 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