the IT Hustle
FerramentasManual de campoSobre
FundamentalsAssistido por IA2026-04-17•9 min de leitura

Hex to Decimal: Number Systems Explained Simply

Por Salty Deprecated Software Engineer

✨ Conteúdo assistido por IA

Este artigo foi gerado com assistência de IA e revisado pela nossa equipe para garantir precisão e qualidade. Todas as informações técnicas e exemplos foram verificados.

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

Escrito sob o pseudônimo editorial do The IT Hustle — mais de 25 anos como técnico de notebooks, administrador de sistemas, engenheiro de storage e engenheiro de software, agora operando agentes de IA. Todo post passa por revisão humana antes de ir ao ar; veja a política editorial.

Nossas ferramentasTodos os artigosSobre nós

Fique por dentro

Seja o primeiro a saber sobre novos tools, artigos e atualizações. Sem spam.

Gere seus próprios prompts anti-alucinação

Nosso AI Prompt Engine usa tecnologia proprietária para gerar prompts com verificação integrada e testes de contradição.

Experimente 3 gerações grátis →

Empresa

  • Sobre
  • Manual de campo
  • Glossário de IA
  • O autor
  • Contato

Produto

  • Ferramentas
  • Monitor de preços
  • Agent Ops
  • Código
  • Design
  • Administração
  • Produtividade
  • Marketing
  • Negócios

Jurídico

  • Política de privacidade
  • Termos de serviço
  • Aviso legal
  • Política editorial
  • Correções

© 2026 Salty Rantz LLC. Todos os direitos reservados.

Feito para profissionais navegando a transformação tecnológica.