the IT Hustle
ツール実践マニュアル概要
FundamentalsAI活用2026-04-17•9 min で読める

Hex to Decimal: Number Systems Explained Simply

著者: Salty Deprecated Software Engineer

✨ AI アシスト コンテンツ

この記事はAIの支援を受けて作成され、正確性と品質についてチームが審査しました。すべての技術情報と例は検証済みです。

You've seen hex color codes in CSS. You've seen 0xFF in low-level code. You've seen binary in networking documentation. These aren't different languages — they're different ways of writing the same numbers. Once that clicks, everything gets easier.

This guide explains the four number bases you'll encounter in computing: binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16). No math degree required.

Why Computers Don't Use Decimal

Humans evolved using base 10 because we have 10 fingers. Computers use base 2 because transistors have two states: on and off. Every number your computer stores is ultimately a sequence of ones and zeros.

Binary (base 2). Uses digits 0 and 1. Every modern computer works in binary at the hardware level.
Octal (base 8). Uses digits 0–7. Appears in Unix file permissions (chmod 755) and older systems.
Decimal (base 10). Uses digits 0–9. The base humans use. What you see in most UIs.
Hexadecimal (base 16). Uses digits 0–9 and letters A–F. Shorthand for binary — one hex digit = four binary bits.

The number 255 is the same number in all four systems — it's just written as 11111111 in binary, 377 in octal, 255 in decimal, and FF in hex.

How Decimal Works (The Model for Everything)

In decimal, each digit position represents a power of 10:

The number 347:

3 × 10² = 3 × 100 = 300

4 × 10¹ = 4 × 10 = 40

7 × 10⁰ = 7 × 1 = 7

Total: 347

Every other number system works the same way — just with a different base instead of 10. Binary uses powers of 2. Hex uses powers of 16. Once you internalize this, converting between bases becomes mechanical.

Binary: The Foundation

Binary uses only 0 and 1. Each digit position is a power of 2:

Binary 1011 to decimal:

1 × 2³ = 1 × 8 = 8

0 × 2² = 0 × 4 = 0

1 × 2¹ = 1 × 2 = 2

1 × 2⁰ = 1 × 1 = 1

Total: 8 + 0 + 2 + 1 = 11

To convert decimal to binary, repeatedly divide by 2 and track the remainders:

Decimal 13 to binary:

13 ÷ 2 = 6 remainder 1 ← least significant bit

6 ÷ 2 = 3 remainder 0

3 ÷ 2 = 1 remainder 1

1 ÷ 2 = 0 remainder 1 ← most significant bit

Read remainders bottom-up: 1101

Key binary reference points every developer should know: 8 bits = 1 byte, max value 255 (11111111). 16 bits = max 65,535. 32 bits = max ~4.3 billion.

Hexadecimal: Binary's Readable Sibling

Binary is unwieldy. The number 255 in binary is eight digits: 11111111. Hex condenses it to two: FF. That's why hex is used everywhere binary is used — it's human-readable shorthand.

Hex uses 16 symbols: 0–9 and A–F (A=10, B=11, C=12, D=13, E=14, F=15).

Hex to decimal reference:

0–9 → 0–9 (same as decimal)

A → 10

B → 11

C → 12

D → 13

E → 14

F → 15

10 → 16

FF → 255

100 → 256

To convert hex to decimal, use powers of 16:

Hex 2A to decimal:

2 × 16¹ = 2 × 16 = 32

A × 16⁰ = 10 × 1 = 10

Total: 32 + 10 = 42

Where You'll Actually See Each Base

Hexadecimal in the wild:
  • CSS colors: #FF5733 (R=255, G=87, B=51)
  • Memory addresses: 0x7fff5fbff8e0
  • Unicode code points: U+1F600 (😀)
  • SHA hashes and UUIDs
  • MAC addresses: 00:1A:2B:3C:4D:5E
Binary in the wild:
  • Network subnet masks: 11111111.11111111.11111111.00000000
  • Bitwise operations in code
  • Flags and permission bitmasks
Octal in the wild:
  • Unix file permissions: chmod 755 (rwxr-xr-x)
  • Legacy C/C++ integer literals: int x = 0777;

The Hex-Binary Shortcut

One hex digit always equals exactly four binary bits (a nibble). This makes converting between hex and binary trivial:

Hex to binary — convert each digit independently:

F = 15 = 1111

A = 10 = 1010

3 = 3 = 0011

FA3 in binary = 1111 1010 0011

This is why programmers use hex — it's direct shorthand for binary without the verbosity.

Converting in Code

You almost never convert by hand in practice. Every programming language has built-in functions:

JavaScript / TypeScript:

parseInt("FF", 16) // hex to decimal → 255

parseInt("1011", 2) // binary to decimal → 11

parseInt("377", 8) // octal to decimal → 255

(255).toString(16) // decimal to hex → "ff"

(255).toString(2) // decimal to binary → "11111111"

(255).toString(8) // decimal to octal → "377"

Python:

int("FF", 16) # hex to decimal → 255

int("1011", 2) # binary to decimal → 11

hex(255) # decimal to hex → "0xff"

bin(255) # decimal to binary → "0b11111111"

oct(255) # decimal to octal → "0o377"

CSS Colors: A Practical Hex Exercise

CSS hex colors are three pairs of hex digits — one pair each for red, green, and blue:

#FF5733 decoded:

FF = 255 → Red at full intensity

57 = 87 → Green at 34%

33 = 51 → Blue at 20%

The shorthand #F00 expands to #FF0000 — pure red. The 3-digit form works when both digits in each pair are identical.

Try it yourself

Use our free Number Base Converter to convert between decimal, binary, octal, and hexadecimal instantly — paste any number in any base and see all the equivalents.

Quick Reference Table

DecimalBinaryOctalHex
0000
1111
21022
410044
81000108
10101012A
15111117F
16100002010
321000004020
64100000010040
1281000000020080
25511111111377FF
256100000000400100

The One Thing to Remember

Different bases are just different notations for the same underlying number. 255 = 0xFF = 0b11111111 = 0o377. They're identical values written in different scripts.

You don't need to master hand conversion. You do need to recognize hex when you see it, understand that CSS color #00FF88 is three bytes, and know that chmod 755 is octal. The rest is Google and parseInt().

IT
Salty Deprecated Software Engineer

The IT Hustleの編集用ペンネームで書いています——ノートPC修理技術者、システム管理者、ストレージエンジニア、ソフトウェアエンジニアとしての25年以上の経験を、今はAIエージェントの運用に注いでいます。すべての記事は公開前に人間が確認します。詳しくは編集方針をご覧ください。

ツール一覧全記事私たちについて

最新情報を受け取る

新しいツール、ブログ記事、アップデートをいち早くお届けします。スパムなし。

独自の反ハルシネーション プロンプトを生成する

AIプロンプトエンジンは独自技術を使い、内蔵の検証・矛盾テスト付きプロンプトを生成します。

無料で3回試す →

会社情報

  • 概要
  • 実践マニュアル
  • AI用語集
  • 筆者について
  • お問い合わせ

プロダクト

  • ツール
  • 料金ウォッチ
  • エージェントオプス
  • コード
  • デザイン
  • システム管理
  • 生産性
  • マーケティング
  • ビジネス

法的情報

  • プライバシーポリシー
  • 利用規約
  • 免責事項
  • 編集方針
  • 訂正について

© 2026 Salty Rantz LLC. 無断複製・転載を禁じます。

テクノロジーの変革を乗り越える人々のために。