DEC2HEX Function in Excel: Decimal to Hexadecimal

⏱ 1 min readUpdated 28 September 2026

EngineeringLevel: IntermediateAvailable in: Excel 2007+

In this article
  1. Syntax
  2. Examples
  3. Example 1
  4. Related functions

DEC2HEX converts numbers to hex — the notation behind web colours and memory addresses.

Syntax

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

Examples

Example 1

="#"&DEC2HEX(A2,2)&DEC2HEX(B2,2)&DEC2HEX(C2,2)

RGB 255, 128, 0 becomes #FF8000.

HEX2DEC · DEC2BIN

📚 Part of the free Excel course: Beginner → Expert · Try it in the Formula Lab or ask the AI Helper.

✨ Ask AI about this article

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

Free · AI can be wrong