Number systems and conversions · Sistemas numéricos y conversiones
| English | Español |
|---|---|
| byte/baɪt/ | byte |
| denary/ˈdiːnəri/ | decimal |
| binary/ˈbaɪnəri/ | binaria |
| bit/bɪt/ | bit |
| nibble/ˈnɪbl/ | nibble |
| hexadecimal/ˌheksəˈdesɪml/ | hexadecimal |
| register width/ˈredʒɪstə wɪtθ/ | ancho de registro |
| kibi/ˈkɪbi/ | kibi |
The terabyte that was not a terabyte
- In 2005 a Californian bought a hard drive labelled 80 GB. His computer reported 74.5 GB. He sued, and the manufacturers eventually paid out: they had counted a gigabyte as a thousand million bytes, and the operating system had counted it as $2^{30}$.
- Neither was lying. There are two families of prefix, one built on powers of ten and one on powers of two, and they drift further apart the bigger the number gets.
- The whole of data representation rests on that idea: a computer stores nothing but 0s and 1s, and everything else is an agreement about how to read them.
- This lesson is the three number systems, the conversions between them, and the two prefix families.
El terabyte que no era un terabyte
- En 2005, un californiano compró un disco duro etiquetado como de 80 GB. Su computadora reportó 74.5 GB. Demandó a los fabricantes y, finalmente, estos pagaron una indemnización: ellos habían contado un gigabyte como mil millones de bytes, mientras que el sistema operativo lo contaba como $2^{30}$.
- Ninguno estaba mintiendo. Existen dos familias de prefijos: una basada en potencias de diez y otra en potencias de dos, y se separan cada vez más cuanto mayor es el número.
- Toda la representación de datos se basa en esa idea: una computadora solo almacena ceros y unos, y todo lo demás es un acuerdo sobre cómo leerlos.
- Esta lección trata sobre los tres sistemas numéricos, las conversiones entre ellos y las dos familias de prefijos.
The three number systems
- Denary 十进制 (base 10) uses digits 0 to 9, with place values that are powers of ten. It is the everyday system.
- Binary 二进制 (base 2) uses 0 and 1, with place values that are powers of two. One digit is a bit 位; 4 bits are a nibble 半字节; 8 bits are a byte 字节.
- Hexadecimal 十六进制 (base 16) uses 0 to 9 then A to F for 10 to 15. One hex digit stands for exactly 4 bits, which is why it is the shorthand programmers use for binary.
| Denary | Binary | Hex |
|---|---|---|
| 10 | 1010 |
A |
| 15 | 1111 |
F |
| 16 | 0001 0000 |
10 |
| 255 | 1111 1111 |
FF |
Every system is place value; only the base changes
Los tres sistemas numéricos
- Decimal (base 10) usa dígitos del 0 al 9, con posiciones de valor que son potencias de diez. Es el sistema cotidiano.
- Binario (base 2) usa 0 y 1, con posiciones de valor que son potencias de dos. Un dígito es un bit; 4 bits forman un nibble; 8 bits forman un byte.
- Hexadecimal (base 16) usa dígitos del 0 al 9 seguidos de A a F para representar valores del 10 al 15. Un dígito hexadecimal equivale exactamente a 4 bits, por lo que es la abreviatura que usan los programadores para representar binarios.
| Decimal | Binario | Hexadecimal |
|---|---|---|
| 10 | 1010 |
A |
| 15 | 1111 |
F |
| 16 | 0001 0000 |
10 |
| 255 | 1111 1111 |
FF |

Cada sistema usa posiciones de valor; solo cambia la base
Number systems · Sistemas numéricos
byte = Σ place values · byte = Σ valores de posición
Each bit is worth a power of two — flip the bits and watch the decimal and hex update. · Cada bit vale una potencia de dos: invierte los bits y observa cómo se actualizan el decimal y el hexadecimal.
How many bits does one hexadecimal digit represent? · ¿Cuántos bits representa un dígito hexadecimal?
One hex digit (0–F) covers 16 values = $2^4$, so it maps to exactly 4 bits (a nibble). · Un dígito hexadecimal (0–F) cubre 16 valores = $2^4$, por lo que se mapea exactamente a 4 bits (un semibyte).
How many bits are in one byte? · ¿Cuántos bits hay en un byte?
A byte is 8 bits (and a nibble is 4 bits). · Un byte son 8 bits (y un semibyte son 4 bits).
Denary to binary
- Method 1, place values: write the powers of two, $128, 64, 32, 16, 8, 4, 2, 1$, and subtract the largest that fits, repeating with what is left. Put a 1 under each one you used.
- Method 2, repeated division: divide by 2 over and over, writing down each remainder, then read the remainders bottom-up.
- $42 = 32 + 8 + 2$, so the bits under 32, 8 and 2 are 1 and the rest are 0:
0010 1010.
Subtract the biggest power of two that fits, and repeat
De decimal a binario
- Método 1, posiciones de valor: escribe las potencias de dos ($128, 64, 32, 16, 8, 4, 2, 1$) y resta la más grande que quepa, repitiendo el proceso con el resto. Coloca un 1 debajo de cada uno que utilices.
- Método 2, división repetida: divide entre 2 una y otra vez, escribiendo cada residuo, y luego lee los residuos de abajo hacia arriba.
- $42 = 32 + 8 + 2$, por lo que los bits bajo 32, 8 y 2 son 1 y el resto son 0:
0010 1010.

Resta la potencia de dos más grande que quepa y repite
Convert denary $13$ to binary (8-bit not required — just the significant bits). · Convierte denario $13$ a binario (no se requieren 8 bits, solo los bits significativos).
$13 = 8 + 4 + 1$, so the columns 8, 4, 1 are set: 1101. · $13 = 8 + 4 + 1$, por lo que las columnas 8, 4 y 1 están activas: 1101.
Convert binary 00101010 to denary. · Convierte binario 00101010 a denario.
$32 + 8 + 2 = 42$ (the 32, 8 and 2 columns are set). · $32 + 8 + 2 = 42$ (las columnas del 32, 8 y 2 están activas).
Worked example: denary 200 to binary and hex
- $200 = 128 + 64 + 8$, so the 8-bit binary is
1100 1000. - Split into nibbles from the right:
1100is 12, which is C;1000is 8. So the hexadecimal isC8. - Check by place value the other way:
C8$= 12 \times 16 + 8 = 200$. ✓ Always show the working; the conversion itself carries the marks.
Ejemplo resuelto: decimal 200 a binario y hexadecimal
- $200 = 128 + 64 + 8$, por lo que el binario de 8 bits es
1100 1000. - Separa en nibbles desde la derecha:
1100es 12, que es C;1000es 8. Por tanto, el hexadecimal esC8. - Verifica usando posiciones de valor en sentido inverso:
C8$= 12 \times 16 + 8 = 200$. ✓ Muestra siempre el procedimiento; la conversión misma otorga los puntos.
Binary and hex, both directions
- Binary to hex: group the bits into nibbles from the right, padding the leftmost group with zeros, and convert each nibble.
0010 0010 1110becomes2 2 E, so22E. - Hex to binary: replace each hex digit with its own 4-bit pattern. No arithmetic needed.
- Hex to denary: multiply each digit by its place value, $16^2 = 256$, $16^1 = 16$, $16^0 = 1$.
22E$= 2 \times 256 + 2 \times 16 + 14 = 558$.
Binario y hexadecimal, en ambas direcciones
- Binario a hexadecimal: agrupa los bits en nibbles desde la derecha, rellenando el grupo más a la izquierda con ceros si es necesario, y convierte cada nibble.
0010 0010 1110se convierte en2 2 E, así que22E. - Hexadecimal a binario: reemplaza cada dígito hexadecimal por su patrón de 4 bits correspondiente. No se necesita aritmética.
- Hexadecimal a decimal: multiplica cada dígito por su posición de valor, $16^2 = 256$, $16^1 = 16$, $16^0 = 1$.
22E$= 2 \times 256 + 2 \times 16 + 14 = 558$.
Convert hexadecimal 2E to denary. · Convierte hexadecimal 2E a denario.
$2 \times 16 + 14 = 32 + 14 = 46$ (E is 14). · $2 \times 16 + 14 = 32 + 14 = 46$ (E es 14).
Convert the binary number 0010 0010 1110 to hexadecimal. · Convierte el número binario 0010 0010 1110 a hexadecimal.
Each nibble converts on its own, from the right: 0010 = 2, 0010 = 2, 1110 = 14 = E. · Cada semibyte se convierte por separado, de derecha a izquierda: 0010 = 2, 0010 = 2, 1110 = 14 = E.
How many bits does a value need?
- Exam questions fix the register width 寄存器宽度 (8, 12 or 16 bits), and you must pad with leading zeros to that width. $558$ in 12 bits is
0010 0010 1110, never10 0010 1110. - An unsigned integer from 0 to $2^n - 1$ needs $n$ bits: 200 needs 8 bits (8 bits reach 255), 1000 needs 10 bits (10 bits reach 1023), 16 needs 5 bits (4 bits stop at 15).
- One hexadecimal digit needs 4 bits, one BCD digit needs 4 bits, and one ASCII character needs 7 bits, or 8 for extended ASCII.
¿Cuántos bits necesita un valor?
- Las preguntas de examen fijan el ancho del registro (8, 12 o 16 bits), y debes rellenar con ceros a la izquierda hasta alcanzar ese ancho. $558$ en 12 bits es
0010 0010 1110, nunca10 0010 1110. - Un entero sin signo de 0 a $2^n - 1$ necesita $n$ bits: 200 necesita 8 bits (8 bits llegan a 255), 1000 necesita 10 bits (10 bits llegan a 1023), 16 necesita 5 bits (4 bits se detienen en 15).
- Un dígito hexadecimal necesita 4 bits, un dígito BCD necesita 4 bits y un carácter ASCII necesita 7 bits, u 8 para el ASCII extendido.
Write denary 558 as a 12-bit binary number (four bits per group, spaces allowed). · Escribe 558 denario como un número binario de 12 bits (cuatro bits por grupo, se permiten espacios).
558 = 512 + 32 + 8 + 4 + 2. Pad with leading zeros to the 12 bits the question asks for; an unpadded answer loses the mark. · 558 = 512 + 32 + 8 + 4 + 2. Rellena con ceros a la izquierda hasta los 12 bits que pide la pregunta; una respuesta sin relleno perderá la puntuación.
Worked example: the minimum number of bits
- A system must store values from 0 to 1000. What is the smallest number of bits?
- Ask which power of two first exceeds 1000. $2^9 = 512$, too small; $2^{10} = 1024$, so ten bits hold 0 to 1023 and 1000 fits.
- The answer is 10 bits, and the reason is the range, not the digit count. A common trap: 16 needs five bits, because four bits stop at 15.
Ejemplo resuelto: el número mínimo de bits
- Un sistema debe almacenar valores de 0 a 1000. ¿Cuál es el número más pequeño de bits?
- Pregúntate qué potencia de dos supera primero a 1000. $2^9 = 512$, demasiado poco; $2^{10} = 1024$, por lo que diez bits abarcan de 0 a 1023 y 1000 cabe dentro.
- La respuesta es 10 bits, y la razón es el rango, no la cantidad de dígitos. Una trampa común: 16 necesita cinco bits, porque cuatro bits se detienen en 15.
What is the smallest number of bits that can store any unsigned value from 0 to 1000? · ¿Cuál es el menor número de bits necesario para almacenar cualquier valor sin signo de 0 a 1000?
Nine bits reach 511, ten bits reach 1023. The question is about the range the bits cover, not the number of digits. · Nueve bits llegan a 511, diez bits llegan a 1023. La pregunta trata sobre el rango que cubren los bits, no sobre el número de dígitos.
Binary prefixes and decimal prefixes
- Decimal prefixes are powers of ten and are used for drive capacities and network speeds: kilo $= 10^3$, mega $= 10^6$, giga $= 10^9$, tera $= 10^{12}$.
- Binary prefixes are powers of two and are used for memory sizes: kibi 二进制千 (Ki) $= 2^{10} = 1024$, mebi (Mi) $= 2^{20}$, gibi (Gi) $= 2^{30}$, tebi (Ti) $= 2^{40}$.
- So a "1 TB" drive holds $10^{12}$ bytes, but an operating system reporting in TiB divides by $2^{40}$ and shows about 0.91. Nothing has been lost; two different units were used.
Prefijos binarios y prefijos decimales
- Los prefijos decimales son potencias de diez y se usan para capacidades de almacenamiento y velocidades de red: kilo $= 10^3$, mega $= 10^6$, giga $= 10^9$, tera $= 10^{12}$.
- Los prefijos binarios son potencias de dos y se usan para tamaños de memoria: kibi (Ki) $= 2^{10} = 1024$, mebi (Mi) $= 2^{20}$, gibi (Gi) $= 2^{30}$, tebi (Ti) $= 2^{40}$.
- Así, un disco "1 TB" contiene $10^{12}$ bytes, pero un sistema operativo que reporta en TiB divide por $2^{40}$ y muestra aproximadamente 0.91. No se ha perdido nada; se han usado dos unidades diferentes.
How many bytes are in 1 kibibyte (KiB)? · ¿Cuántos bytes hay en 1 kibibyte (KiB)?
A kibibyte is $2^{10} = 1024$ bytes (a binary prefix, used for memory). · Un kibibyte es $2^{10} = 1024$ bytes (un prefijo binario, usado para memoria).
A drive sold as 1 TB holds fewer bytes than 1 TiB of memory. · Un disco vendido como 1 TB tiene menos bytes que 1 TiB de memoria.
1 TB is 10^12 bytes; 1 TiB is 2^40, about 1.1 x 10^12. Decimal prefixes for drives, binary prefixes for memory. · 1 TB son 10^12 bytes; 1 TiB son 2^40, aproximadamente 1.1 x 10^12. Prefijos decimales para discos, prefijos binarios para memoria.
Where hexadecimal is actually used
- Memory addresses and machine code, because one hex digit is exactly one nibble and a byte is exactly two hex digits, so a dump is readable at a glance.
- Colour codes in web pages:
#FF8800is one byte each of red, green and blue. MAC addresses and error codes likewise. - The reason is always the same: hex is a shorthand for binary that a person can read and write without mistakes, not a system the computer itself uses.
Dónde se usa realmente el hexadecimal
- Direcciones de memoria y código máquina, porque un dígito hexadecimal equivale exactamente a un nibble y un byte equivale exactamente a dos dígitos hexadecimales, haciendo que un volcado sea legible a simple vista.
- Códigos de color en páginas web:
#FF8800representa un byte cada uno de rojo, verde y azul. Los direcciones MAC y los códigos de error también. - La razón es siempre la misma: el hexadecimal es una abreviatura del binario que una persona puede leer y escribir sin errores, no un sistema que use la propia computadora.
Where is hexadecimal used in practice? Select all · todos that apply. · ¿Dónde se usa hexadecimal en la práctica? Selecciona todos los que correspondan.
Hex is a human-readable shorthand for binary: one digit per nibble, two per byte. The processor itself works in binary. · El hexadecimal es una abreviatura legible para humanos del binario: un dígito por semibyte, dos por byte. El propio procesador funciona en binario.
Marks that slip away
- Pad to the width the question gives. An unpadded answer loses the mark even when the bits are right.
- Group nibbles from the right, not the left, or every hex digit shifts.
- 4 bits reach 15, 8 bits reach 255, 10 bits reach 1023. "How many bits" is a question about the range.
- A kibibyte is 1024 bytes and a kilobyte is 1000. Say which you used in any size calculation.
Puntos que se pierden fácilmente
- Rellena hasta el ancho que indique la pregunta. Una respuesta sin rellenar pierde el punto aunque los bits sean correctos.
- Agrupa los nibbles desde la derecha, no desde la izquierda, o cada dígito hexadecimal cambiará de posición.
- 4 bits llegan a 15, 8 bits llegan a 255, 10 bits llegan a 1023. "Cuántos bits" es una pregunta sobre el rango.
- Un kibibyte son 1024 bytes y un kilobyte son 1000. Especifica cuál usaste en cualquier cálculo de tamaño.
You've got it
- denary base 10, binary base 2 (bit, nibble = 4 bits, byte = 8 bits), hexadecimal base 16 where one digit is exactly one nibble
- denary to binary by subtracting powers of two or by repeated division reading remainders bottom-up; binary to hex by grouping nibbles from the right; hex to denary by place value
- pad to the register width; an unsigned value needs $n$ bits where $2^n$ first exceeds it
- decimal prefixes are powers of ten (drives, networks), binary prefixes powers of two (memory): kibi $= 1024$
Ya lo dominas
- decimal base 10, binario base 2 (bit, nibble = 4 bits, byte = 8 bits), hexadecimal base 16 donde un dígito equivale exactamente a un nibble
- Conversión de decimal a binario restando potencias de dos o dividiendo repetidamente leyendo residuos de abajo hacia arriba; binario a hexadecimal agrupando nibbles desde la derecha; hexadecimal a decimal usando posiciones de valor
- Rellena hasta el ancho del registro; un valor sin signo necesita $n$ bits donde $2^n$ lo supere por primera vez
- Los prefijos decimales son potencias de diez (almacenamiento, redes), los prefijos binarios son potencias de dos (memoria): kibi $= 1024$