Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Number Systems

Base 10 (Decimal)
Base 10 numbers are the numbers that are used in everyday mathematics and counting
Base 10 numbers are represented by 10 digits, 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9
Each base 10 digit denotes a power of 10
For example:

100 = 1
101 = 10
102 = 100
103 = 1000
…etc.

839510 = (8*103) + (3*102) + (9*101) + (5*100) = (8000 + 300 + 90 + 5)

8 3 9 5
_____ ____ ____ _____
103 102 101 100
Thousands Hundreds Tens Ones

Although this is the “natural” way to imagine numbers, it is also how other number systems are represented. We can substitute the
base 10 with another number base.

In Computer Science, common number systems are base 2 (binary), base 8 (octal), and base 16 (hexadecimal).

Base 2 (Binary)
Binary number usage examples include the representation of computer bits
Binary numbers are represented by two digits, 0 and 1
Each base 2 digit denotes a power of 2
For Example:

20 = 1
21 = 2
22 = 4
23 = 8
…etc.

To convert 11112 (in base 2) to Decimal (base 10):

1 1 1 1
_____ ____ ____ _____
23 22 21 20

11112 = (1*23) + (1*22) + (1*21) + (1*20) = (8 + 4 + 2 + 1) = 15 (in base 10)

Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
Base 8 (Octal)
Octal number usage examples include Linux read, write, and execute permissions
Octal numbers are represented by eight digits, 0, 1, 2, 3, 4, 5, 6, and 7
Each base 8 digit denotes a power of 8
For Example:

80 = 1
81 = 8
82 = 64
83 = 512
…etc.

To convert 73528 (in base 8) to Decimal (base 10):

7 3 5 2
_____ ____ ____ _____
83 82 81 80

73528 = (7*83) + (3*82) + (5*81) + (2*20) = (3584 + 192 + 40 + 2) = 3818 (in base 10)

Base 16 (Hexadecimal)
Hexadecimal numbers usage examples include memory locations, colors, and MAC addresses
Hexadecimal (Hex) numbers are represented by 16 digits, 0,1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F
(Where A = 10, B = 11, C = 12, D + 13, E = 14, and F = 15)
Each base 16 digit denotes a power of 16
For Example:

160 = 1
161 = 16
162 = 256
163 = 4096
…etc.

To convert 17EF16 (in base 16) to Decimal (base 10):

1 7 E F
_____ ____ ____ _____
163 162 161 160

17EF16 = (1*163) + (7*162) + (14*161) + (15*160) = (4096 + 1792 + 224 + 15) = 6127 (in base 10)

Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. 2
Standard ASCII Characters (0 – 128)
Dec Bin Hex Oct Char Description
0 0000 00 000 ^@ Null (NUL)
1 0001 01 001 ^A Start of heading (SOH)
2 0010 02 002 ^B Start of text (STX)
3 0011 03 003 ^C End of text (ETX)
4 0100 04 004 ^D End of transmission (EOT)
5 0101 05 005 ^E Enquiry (ENQ)
6 0110 06 006 ^F Acknowledge (ACK)
7 0111 07 007 ^G Bell (BEL)
8 1000 08 010 ^H Backspace (BS)
9 1001 09 011 ^I Horizontal tab (HT)
10 1010 0A 012 ^J Line feed (LF)
11 1011 0B 013 ^K Vertical tab (VT)
12 1100 0C 014 ^L New page/form feed (FF)
13 1101 0D 015 ^M Carriage return (CR)
14 1110 0E 016 ^N Shift out (SO)
15 1111 0F 017 ^O Shift in (SI)
16 10000 10 020 ^P Data link escape (DLE)
17 10001 11 021 ^Q Device control 1 (DC1)
18 10010 12 022 ^R Device control 2 (DC2)
19 10011 13 023 ^S Device control 3 (DC3)
20 1011 14 024 ^T Device control 4 (DC4)
21 10101 15 025 ^U Negative acknowledge (NAK)
22 10110 16 026 ^V Synchronous idle (SYN)
23 10111 17 027 ^W End of transmission block (ETB)
24 11000 18 030 ^X Cancel (CAN)
25 11001 19 031 ^Y End of medium (EM)
26 11010 1A 032 ^Z Substitute (SUB)
27 11011 1B 033 ^[ Escape (ESC)
28 11100 1C 034 ^\ File separator (FS)
29 11101 1D 035 ^] Group separator (GS)
30 11110 1E 036 ^^ Record separator (RS)
31 11111 1F 037 ^_ Unit separator (US)
32 100000 20 040 Space
33 100001 21 041 ! Exclamation mark
34 100010 22 042 " Quotation mark/Double quote
35 100011 23 043 # Number sign
36 100100 24 044 $ Dollar sign
37 100101 25 045 % Percent sign

Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. 3
Dec Bin Hex Oct Char Description
38 100110 26 046 & Ampersand
39 100111 27 047 ' Apostrophe/Single quote
40 101000 28 050 ( Left parenthesis
41 101001 29 051 ) Right parenthesis
42 101010 2A 052 * Asterisk
43 101011 2B 053 + Plus sign
44 101100 2C 054 , Comma
45 101101 2D 055 - Hyphen/Minus
46 101110 2E 056 . Full stop/Period
47 101111 2F 057 / Solidus/Slash
48 110000 30 060 0 Digit zero
49 110001 31 061 1 Digit one
50 110010 32 062 2 Digit two
51 110011 33 063 3 Digit three
52 110100 34 064 4 Digit four
53 110101 35 065 5 Digit five
54 110110 36 066 6 Digit six
55 110111 37 067 7 Digit seven
56 111000 38 070 8 Digit eight
57 111001 39 071 9 Digit nine
58 111010 3A 072 : Colon
59 111011 3B 073 ; Semicolon
60 111100 3C 074 < Less-than sign
61 111101 3D 075 = Equal/Equality sign
62 111110 3E 076 > Greater-than sign
63 111111 3F 077 ? Question mark
64 1000000 40 100 @ Commercial at/At sign
65 1000001 41 101 A Latin capital letter A
66 1000010 42 102 B Latin capital letter B
67 1000011 43 103 C Latin capital letter C
68 10001000 44 104 D Latin capital letter D
69 1000101 45 105 E Latin capital letter E
70 1000110 46 106 F Latin capital letter F
71 1000111 47 107 G Latin capital letter G
72 1001000 48 110 H Latin capital letter H
73 1001001 49 111 I Latin capital letter I
74 1001010 4A 112 J Latin capital letter J
75 10001011 4B 113 K Latin capital letter K
76 1001100 4C 114 L Latin capital letter L
77 1001101 4D 115 M Latin capital letter M

Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. 4
Dec Bin Hex Oct Char Description
78 1001110 4E 116 N Latin capital letter N
79 1001111 4F 117 O Latin capital letter O
80 1010000 50 120 P Latin capital letter P
81 1010001 51 121 Q Latin capital letter Q
82 1010010 52 122 R Latin capital letter R
83 1010011 53 123 S Latin capital letter S
84 1010100 54 124 T Latin capital letter T
85 1010101 55 125 U Latin capital letter U
86 1010110 56 126 V Latin capital letter V
87 1010111 57 127 W Latin capital letter W
88 1011000 58 130 X Latin capital letter X
89 1011001 59 131 Y Latin capital letter Y
90 1011010 5A 132 Z Latin capital letter Z
91 1011011 5B 133 [ Left square bracket
92 1011100 5C 134 \ Reverse solidus/Backslash
93 1011101 5D 135 ] Right square bracket
94 1011110 5E 136 ^ Circumflex accent/Caret
95 1011111 5F 137 _ Underscore/Low line
96 1100000 60 140 ` Grave accent
97 1100001 61 141 a Latin small letter a
98 1100010 62 142 b Latin small letter b
99 1100011 63 143 c Latin small letter c
100 1100100 64 144 d Latin small letter d
101 1100101 65 145 e Latin small letter e
102 1100110 66 146 f Latin small letter f
103 1100111 67 147 g Latin small letter g
104 1101000 68 150 h Latin small letter h
105 1101001 69 151 i Latin small letter i
106 1101010 6A 152 j Latin small letter j
107 1101011 6B 153 k Latin small letter k
108 1101100 6C 154 l Latin small letter l
109 1101101 6D 155 m Latin small letter m
110 1101110 6E 156 n Latin small letter n
111 1101111 6F 157 o Latin small letter o
112 1110000 70 160 p Latin small letter p
113 1110001 71 161 q Latin small letter q
114 1110010 72 162 r Latin small letter r
115 1110011 73 163 s Latin small letter s
116 1110100 74 164 t Latin small letter t
117 1110101 75 165 u Latin small letter u

Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. 5
Dec Bin Hex Oct Char Description
118 1110110 76 166 v Latin small letter v
119 1110111 77 167 w Latin small letter w
120 1111000 78 170 x Latin small letter x
121 1111001 79 171 y Latin small letter y
122 1111010 7A 172 z Latin small letter z
123 1111011 7B 173 { Left curly bracket
124 1111100 7C 174 | Vertical line/Vertical bar
125 1111101 7D 175 } Right curly bracket
126 1111110 7E 176 ~ Tilde
127 1111111 7F 177 DEL Delete (DEL)

Can you represent the characters for the word Help! in Binary, Octal, and Hexadecimal?

Solution:

Binary

10010000 1100101 1101100 1110000 100001

Octal

110 145 154 160 041

Hexadecimal

48 65 6C 70 21

Copyright © 2022, Oracle and/or its affiliates. Oracle, Java, and MySQL are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. 6

You might also like