Number Base Converter
Conversion entre bases numeriques : binaire, octal, decimal, hexadecimal.
Convertisseur
0b
0o
0x
Bits: 0
Bytes: 0
ASCII: -
Operations bit a bit
A:
10101010
=
170
B:
00001111
=
15
=
00001010
=
10
=
0x0A
Representation binaire (8 bits)
128
64
32
16
8
4
2
1
0
0
0
0
0
0
0
0
Cliquez sur les bits pour les basculer
Table de reference
| Dec | Hex | Oct | Bin | Char |
|---|
Prefixes de base
| Base | Prefixe | Exemple |
|---|---|---|
| Binaire | 0b | 0b1010 |
| Octal | 0o ou 0 | 0o12 ou 012 |
| Decimal | (aucun) | 10 |
| Hexadecimal | 0x | 0xA |
Conversion en CLI
# Bash - decimal vers autres bases
echo "obase=2; 255" | bc # Binaire: 11111111
echo "obase=16; 255" | bc # Hex: FF
printf '%x\n' 255 # Hex: ff
# Bash - hex vers decimal
echo $((0xFF)) # 255
printf '%d\n' 0xFF # 255
# Python
bin(255) # '0b11111111'
oct(255) # '0o377'
hex(255) # '0xff'
int('FF', 16) # 255