mail us  |  mail this page

contact us
training  | 
tech stuff  | 

Tech Stuff - Hexadecimal, Decimal and Binary

The basic unit used in the computer world is the byte (a.k.a octet), a byte (or octet) has 8 bits (a.k.a binary digits). Most modern systems use multiples of a byte, thus, a 16-bit system is comprised of 2 bytes (2 x 8 = 16), a 32-bit system has 4 bytes (4 x 8 = 32) and a 64-bit system has 8 bytes (8 x 8 = 64). The term word, as in the description 32-bit word has largely disappeared from the technical lexicon.

The contents of any byte, for instance, in a memory location or on a network, can be expressed in many numbering systems. The most commonly used numbering systems are Decimal, Hexadecimal and Binary:

Numbering System Base Range Notes
Decimal base 10 0 - 1,2,3... The most common numbering system - dollars, metric etc. A byte (8 bits) has 256 possible values in the range 0 - 255
Binary base 2 0 - 1 The basic level at which the electronic circuitry in a computer works - a single bit.
Hexadecimal base 16 0-9, A-F Each Hexadecimal character represents 4 bits (0 - 15 decimal) which is called a nibble (a small byte - honest!). A byte (or octet) is 8 bits so is always represented by 2 Hex characters in the range 00 to FF.

Historical Note: Once upon a time, when the world, and even the author of this page, was young, computers were built with 12-bit, 24-bit and even 36-bit words (it made some sense then, just looks strange today). Each of these word sizes is divisible by 3 and used an octal (base 8) numbering system. Each 3 bit element contained 8 values in the range 0 to 7. Thus, a memory location with the 12-bit binary value of 000.001.100.111 would be written in octal as 0147.

Bit numbering

When working with binary each bit within a byte (octet) may need to be identified using a technique called bit numbering. Bit numbering can be very confusing with various standard bodies adopting different conventions. The following are all valid, and used, bit numbering conventions for describing an 8 bit byte (an octet).

Memory contents 0 0 0 0 0 0 0 0
Bit numbering conventions
Left to right base 0 (IETF) 0 1 2 3 4 5 6 7
Left to right base 1 1 2 3 4 5 6 7 8
Right to left base 1 (ITU) 8 7 6 5 4 3 2 1
Power of 2 7 6 5 4 3 2 1 0

Always check what convention is used on any specification. We have bowed to the inevitable and use the Left to right base 0 (IETF) standard since, because of the Internet, it is widely used and, hopefully, equally widely understood. The IETF's rationale for this standard is that it also represents unambiguously what is called network order, that is, bit 0 goes onto a network first, bit 1 second and so on. Bits also tend to come off the network in the same order they went on. Use of network order is necessary since the internal (machine) representation of data can vary enormously (all that big-endian, little-endian nonsense) but when data is stuffed onto a network it must be in a consistent order that can be used by any system, irrespective of its internal representation, that wants to use the data.

Finally, when working with binary you will frequently come accross the terms Most Significant Bit(s) (MSB) and Least Significant Bit(s) (LSB). The MSB is always on the LEFT and the LSB on the RIGHT. Thus, using IETF bit numbering the MSB is bit 0 and the LSB is bit 7, whereas using ITU bit numbering the MSB is bit 8 and the LSB is bit 1. Crystal clear, right?

8 bit byte (octet) Conversion Table:

IPv4 Decimal to Hex Conversion

Decimal Hexadecimal Binary Decimal Hexadecimal Binary
0 00 0000 0000 128 80 1000 0000
1 01 0000 0001 129 81 1000 0001
2 02 0000 0010 130 82 1000 0010
3 03 0000 0011 131 83 1000 0011
4 04 0000 0100 132 84 1000 0100
5 05 0000 0101 133 85 1000 0101
6 06 0000 0110 134 86 1000 0110
7 07 0000 0111 135 87 1000 0111
8 08 0000 1000 136 88 1000 1000
9 09 0000 1001 137 89 1000 1001
10 0A 0000 1010 138 8A 1000 1010
11 0B 0000 1011 139 8B 1000 1011
12 0C 0000 1100 140 8C 1000 1100
13 0D 0000 1101 141 8D 1000 1101
14 0E 0000 1110 142 8E 1000 1110
15 0F 0000 1111 143 8F 1000 1111
16 10 0001 0000 144 90 1001 0000
17 11 0001 0001 145 91 1001 0001
18 12 0001 0010 146 92 1001 0010
19 13 0001 0011 147 93 1001 0011
20 14 0001 0100 148 94 1001 0100
21 15 0001 0101 149 95 1001 0101
22 16 0001 0110 150 96 1001 0110
23 17 0001 0111 151 97 1001 0111
24 18 0001 1000 152 98 1001 1000
25 19 0001 1001 153 99 1001 1001
26 1A 0001 1010 154 9A 1001 1010
27 1B 0001 1011 155 9B 1001 1011
28 1C 0001 1100 156 9C 1001 1100
29 1D 0001 1101 157 9D 1001 1101
30 1E 0001 1110 158 9E 1001 1110
31 1F 0001 1111 159 9F 1001 1111
32 20 0010 0000 160 A0 1010 0000
33 21 0010 0001 161 A1 1010 0001
34 22 0010 0010 162 A2 1010 0010
35 23 0010 0011 163 A3 1010 0011
36 24 0010 0100 164 A4 1010 0100
37 25 0010 0101 165 A5 1010 0101
38 26 0010 0110 166 A6 1010 0110
39 27 0010 0111 167 A7 1010 0111
40 28 0010 1000 168 A8 1010 1000
41 29 0010 1001 169 A9 1010 1001
42 2A 0010 1010 170 AA 1010 1010
43 2B 0010 1011 171 AB 1010 1011
44 2C 0010 1100 172 AC 1010 1100
45 2D 0010 1101 173 AD 1010 1101
46 2E 0010 1110 174 AE 1010 1110
47 2F 0010 1111 175 AF 1010 1111
48 30 0011 0000 176 B0 1011 0000
49 31 0011 0001 177 B1 1011 0001
50 32 0011 0010 178 B2 1011 0010
51 33 0011 0011 179 B3 1011 0011
52 34 0011 0100 180 B4 1011 0100
53 35 0011 0101 181 B5 1011 0101
54 36 0011 0110 182 B6 1011 0110
55 37 0011 0111 183 B7 1011 0111
56 38 0011 1000 184 B8 1011 1000
57 39 0011 1001 185 B9 1011 1001
58 3A 0011 1010 186 BA 1011 1010
59 3B 0011 1011 187 BB 1011 1011
60 3C 0011 1100 188 BC 1011 1100
61 3D 0011 1101 189 BD 1011 1101
62 3E 0011 1110 190 BE 1011 1110
63 3F 0011 1111 191 BF 1011 1111
64 40 0100 0000 192 C0 1100 0000
65 41 0100 0001 193 C1 1100 0001
66 42 0100 0010 194 C2 1100 0010
67 43 0100 0011 195 C3 1100 0011
68 44 0100 0100 196 C4 1100 0100
69 45 0100 0101 197 C5 1100 0101
70 46 0100 0110 198 C6 1100 0110
71 47 0100 0111 199 C7 1100 0111
72 48 0100 1000 200 C8 1100 1000
73 49 0100 1001 201 C9 1100 1001
74 4A 0100 1010 202 CA 1100 1010
75 4B 0100 1011 203 CB 1100 1011
76 4C 0100 1100 204 CC 1100 1100
77 4D 0100 1101 205 CD 1100 1101
78 4E 0100 1110 206 CE 1100 1110
79 4F 0100 1111 207 CF 1100 1111
80 50 0101 0000 208 D0 1101 0000
81 51 0101 0001 209 D1 1101 0001
82 52 0101 0010 210 D2 1101 0010
83 53 0101 0011 211 D3 1101 0011
84 54 0101 0100 212 D4 1101 0100
85 55 0101 0101 213 D5 1101 0101
86 56 0101 0110 214 D6 1101 0110
87 57 0101 0111 215 D7 1101 0111
88 58 0101 1000 216 D8 1101 1000
89 59 0101 1001 217 D9 1101 1001
90 5A 0101 1010 218 DA 1101 1010
91 5B 0100 1011 219 DB 1101 1011
92 5C 0101 1100 220 DC 1101 1100
93 5D 0101 1101 221 DD 1101 1101
94 5E 0101 1110 222 DE 1101 1110
95 5F 0101 1111 223 DF 1101 1111
96 60 0110 0000 224 E0 1110 0000
97 61 0110 0001 225 E1 1110 0001
98 62 0110 0010 226 E2 1110 0010
99 63 0110 0011 227 E3 1110 0011
100 64 0110 0100 228 E4 1110 0100
101 65 0110 0101 229 E5 1110 0101
102 66 0110 0110 230 E6 1110 0110
103 67 1110 0111 231 E7 1110 0111
104 68 0110 1000 232 E8 1110 1000
105 69 0110 1001 233 E9 1110 1001
106 6A 0110 1010 234 EA 1110 1010
107 6B 0110 1011 235 EB 1110 1011
108 6C 0110 1100 236 EC 1110 1100
109 6D 0110 1101 237 ED 1110 1101
110 6E 0110 1110 238 EE 1110 1110
111 6F 0110 1111 239 EF 1110 1111
112 70 0111 0000 240 F0 1111 0000
113 71 0111 0001 241 F1 1111 0001
114 72 0111 0010 242 F2 1111 0010
115 73 0111 0011 243 F3 1111 0011
116 74 0111 0100 244 F4 1111 0100
117 75 0111 0101 245 F5 1111 0101
118 76 0111 0110 246 F6 1111 0110
119 77 1111 0111 247 F7 1111 0111
120 78 0111 1000 248 F8 1111 1000
121 79 0111 1001 249 F9 1111 1001
122 7A 0111 1010 250 FA 1111 1010
123 7B 0111 1011 251 FB 1111 1011
124 7C 0111 1100 252 FC 1111 1100
125 7D 0111 1101 253 FD 1111 1101
126 7E 0111 1110 254 FE 1111 1110
127 7F 0111 1111 255 FF 1111 1111

IPv4 Decimal to Hex Conversion

To convert a dotted decimal IPv4 address to hexadecimal, take each dotted decimal value and convert it using a hex calculator (standard windows calculator in scientific or prgrammer mode will do the job). This will yield:

IP address in dotted decimal = 192.168.0.5
Decimal 192 = Hexadecimal = C0
Decimal 168 = Hexadecimal = A8
Decimal 0   = Hexadecimal = 00
Decimal 5   = Hexadecimal = 05
IP Address in dotted hex = C0.A8.00.05


Problems, comments, suggestions, corrections (including broken links) or something to add? Please take the time from a busy life to 'mail us' (at top of screen), the webmaster (below) or info-support at zytrax. You will have a warm inner glow for the rest of the day.

Tech Stuff

RSS Feed Icon

If you are happy it's OK - but your browser is giving a less than optimal experience on our site. You could, at no charge, upgrade to a W3C standards compliant browser such as Firefox

Search

web zytrax.com

Share

Icons made by Icomoon from www.flaticon.com is licensed by CC 3.0 BY
share page via facebook tweet this page

Page

email us Send to a friend feature print this page Display full width page Decrease font size Increase font size

Standards

ISO (International)
IEC (International)
ANSI (US)
DIN (Germany)
ETSI (EU)
BSI (UK)
AFNOR (France)

Telecom

TIA (US)
ECIA (US)
ITU (International)
IEEE (US)
ETSI (EU)
OFCOM (UK)

Internet

IETF
IETF-RFCs
IANA
ICANN
W3C

Electronics

JEDEC
ECIA (US)

Site

CSS Technology SPF Record Conformant Domain
Copyright © 1994 - 2024 ZyTrax, Inc.
All rights reserved. Legal and Privacy
site by zytrax
hosted by javapipe.com
web-master at zytrax
Page modified: May 24 2023.