Calculadora Hexadecimal
Converta entre hexadecimal, decimal e binário
Hex Calculator
Convert between decimal and hexadecimal
Enter a decimal integer
Divide by 16 repeatedlyWhat is a Hex Calculator?
A Hex Calculator is a tool for working with hexadecimal numbers (also called hex), which use base 16 instead of base 10. Hexadecimal uses sixteen symbols: 0–9 and A–F, where A = 10, B = 11, C = 12, D = 13, E = 14, and F = 15.
Hex is widely used in computing because it's a compact way to represent binary data. Since 1 hex digit equals 4 binary bits, long binary values can be written much shorter in hex. For example: binary 1111 = hex F, and binary 10101100 = hex AC.
This Calculator Supports Multiple Conversions
- Decimal → Hexadecimal -- convert base-10 numbers to base-16
- Decimal → Binary -- convert base-10 numbers to base-2
Hex calculators are useful for converting between hex, decimal, and binary, working with colors in web design (e.g., #FF0000 for red), and understanding memory addresses, machine code, and other low-level computing concepts.
How to Use This Hex Calculator
- Enter a decimal number -- type any integer into the input field (e.g., 255)
- Click "Calculate" -- to convert the number
- Review both outputs -- the result shows the hexadecimal (base 16) and binary (base 2) representations simultaneously
- Try other values -- explore common values like 16, 128, 255, 256, or any decimal you need to convert
Tips:
- Hex values often appear with a prefix like 0x (example: 0xFF). This calculator displays the raw hex digits without a prefix.
- Hex uses only 0–9 and A–F. If you see an error, check for invalid characters.
- Leading zeros (like 00FF) don't change the value, but can be useful when you want a fixed byte length.
Hex Formulas
Hex Place Value (Base 16)
Hex works like decimal place value, but with powers of 16:
value = Σ dᵢ × 16ⁱ (i = 0 to k)
Where each digit dᵢ can be 0–15 (0–9 or A–F)
Example: 1A₁₆ = 1×16¹ + 10×16⁰ = 16 + 10 = 26₁₀
Converting Decimal to Hex
Repeatedly divide by 16 and record remainders:
- Divide the number by 16
- Record the remainder (0–15, using A–F for 10–15)
- Divide the quotient by 16 and repeat until the quotient is 0
- Read the remainders from bottom to top
Hex to Binary Conversion Table
Each hex digit maps directly to a 4-bit binary group:
0
0000
1
0001
2
0010
3
0011
4
0100
5
0101
6
0110
7
0111
8
1000
9
1001
A
1010
B
1011
C
1100
D
1101
E
1110
F
1111
Hex Addition (Concept)
Hex addition follows the same idea as decimal addition, but carries happen at 16 instead of 10. If a digit sum is 16 or more, write the remainder and carry 1 to the next place.
Example Calculations
Example 1: Convert Hex to Decimal
Convert: 1A₁₆ to decimal
Calculation: 1×16 + 10 = 26
Result: 1A₁₆ = 26₁₀
Example 2: Convert Hex to Binary
Convert: 2F₁₆ to binary
Steps:
- 2 = 0010
- F = 1111
Result: 2F₁₆ = 00101111₂
Example 3: Convert Decimal to Hex
Convert: 255₁₀ to hex
Steps:
- 255 ÷ 16 = 15 remainder 15
- 15 in hex = F, remainder 15 = F
Result: 255₁₀ = FF₁₆
Example 4: Hex Addition
Add: A5₁₆ + 1C₁₆
Verify via decimal:
- A5₁₆ = 10×16 + 5 = 165
- 1C₁₆ = 1×16 + 12 = 28
- 165 + 28 = 193
- 193 ÷ 16 = 12 remainder 1 → C1
Result: A5₁₆ + 1C₁₆ = C1₁₆
Frequently Asked Questions
Why is hexadecimal used in computing?
Hex is a compact way to represent binary. Since 1 hex digit equals 4 bits, it's much easier to read and write than long binary strings, especially for memory addresses and machine data.
What do the letters A–F mean in hex?
They represent values 10 through 15: A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.
What's the difference between hex and binary?
Binary is base 2 (0 and 1). Hex is base 16 (0–9 and A–F). Hex is often used as a shorthand for binary because it compresses 4 bits into 1 character.
What does "0x" mean in front of a number?
"0x" is a common prefix used in programming to indicate a hexadecimal number. For example, 0xFF means FF in hex (255 in decimal).
Why do hex values appear in colors like #FF0000?
In web design, colors are commonly represented as three hex pairs for Red, Green, and Blue (RGB). Each pair ranges from 00 to FF (0 to 255 in decimal). For example, #FF0000 is full red, no green, no blue.
Want to add this hex calculator to your website? Get a custom embed code that matches your site's design and keeps visitors engaged.
O que é o sistema hexadecimal?
O sistema hexadecimal (base 16) usa os dígitos 0–9 e as letras A–F, onde A=10, B=11, C=12, D=13, E=14 e F=15. É compacto por natureza — um único dígito hex representa exatamente 4 bits binários — o que o torna ideal para expressar dados binários de forma legível para humanos. Você vai encontrá-lo em programação, endereços de memória, código de máquina e em qualquer lugar onde valores binários grandes precisam continuar legíveis sem ocupar muito espaço.
Esta calculadora converte entre hex, decimal e binário instantaneamente, e também realiza aritmética hexadecimal como adição e subtração. É uma ferramenta indispensável para designers web que trabalham com códigos de cor #RRGGBB, programadores depurando endereços de memória ou valores de registradores, e qualquer pessoa que faça operações bit a bit. Seja lendo um dump de registradores de CPU ou escolhendo a cor de fundo de um site, o hexadecimal é a linguagem que você precisa.
Como usar a calculadora hexadecimal
- Digite um número hexadecimal usando dígitos 0–9 e letras A–F, ou um número decimal para converter da base 10.
- Selecione a direção da conversão: hex para decimal, decimal para hex ou hex para binário.
- Clique em Calcular para processar a conversão ou a aritmética.
- Leia as três representações em base lado a lado: hexadecimal, decimal e binário.
Fórmulas de conversão hexadecimal
Hex para Decimal: multiplique cada dígito por 16^posição
1A3₁₆ = 1×16² + 10×16¹ + 3×16⁰ = 256 + 160 + 3 = 419
Decimal para Hex: divida por 16, colete os restos
255 ÷ 16 = 15 resto 15 (F), então 255₁₀ = FF₁₆
Dígitos hex: 0-9 = 0-9, A=10, B=11, C=12, D=13, E=14, F=15
Códigos de cor: #RRGGBB — dois dígitos hex para Vermelho, Verde, Azul (0-255)Cada dígito hexadecimal corresponde exatamente a 4 bits binários (um "nibble"). Dois dígitos hex formam um byte, variando de 00 a FF — ou seja, de 0 a 255 em decimal. É por isso que cada canal de cor no #RRGGBB vai de 00 (0) a FF (255).
Exemplos resolvidos
FF₁₆ = 255₁₀ — O valor máximo de um byte
FF em hexadecimal é o maior valor que cabe em um único byte (8 bits). Na cor RGB, FF significa intensidade máxima, então #FFFFFF é branco puro (os três canais no máximo) e #000000 é preto puro (todos os canais em 0).
Decodificando um código de cor hex: #1A2B3C
Divida em três pares: R = 1A₁₆ = 26₁₀, G = 2B₁₆ = 43₁₀, B = 3C₁₆ = 60₁₀. Portanto, #1A2B3C é um azul-cinza escuro com vermelho=26, verde=43, azul=60. É exatamente assim que os seletores de cor CSS funcionam por baixo dos panos.
1000₁₀ = 3E8₁₆
Para converter 1000 para hex: 1000 ÷ 16 = 62 resto 8, depois 62 ÷ 16 = 3 resto 14 (E), depois 3 ÷ 16 = 0 resto 3. Lendo os restos de baixo para cima: 3E8. Então mil em decimal é 3E8 em hexadecimal.