ASCII Codes For Common Keyboard Characters

Decimal and Binary Conversions For Useful Numbers, Letters and Chars

© Martin Bell

Jul 1, 2009
Figure 1 - ASCII Codes For Number Digits, M Bell
This article states what the ASCII codes are for the commonly used keyboard characters, and is a handy reference to convert decimal to binary and binary to decimal.

Converting decimal numbers to binary and binary numbers to decimal is described as a procedure in Decimal, Binary, Octal and Hexadecimal Number Systems, but the actual conversions are shown here for the numbers between 0 and 255. It is particularly useful to know the decimal and binary ASCII values for number characters, letters, currency symbols, punctuation, and special keyboard characters. These are listed here, along with the reason for their use.

Converting Binary to Decimal and Decimal to Binary

The conversions for many of the numbers from 0 to 255 are shown in Figures 1 to 4. There are methods or algorithms that may be used to achieve the same result, but for convenience the Microsoft Excel functions bin2dec(x) and dec2bin(x,y) may be used very easily. For example, the decimal number 15 may be written in binary as 1111, so the functions may be used thus:

=bin2dec(1111)

... will give the answer 15.

The opposite is:

=dec2bin(15,4)

... will give the decimal number 15 as a 4-digit binary answer 1111, whereas

=dec2bin(15,8)

... will give the decimal number 15 as an 8-digit answer 00001111

ASCII Characters Used in Programming

The C programming language supports binary (as well as decimal, octal, and hexadecimal number formats), so binary and decimal may be used directly. Not all languages do this, however, and a look-up table or algorithm is needed. Another use is that the delimiter in a line of C code, Java and others, is a semicolon ( ; ), so trying to print a semicolon using C may not work directly. In this case, the ASCII value of 59 (decimal) or 00111011) may be printed, giving the desired output.

ASCII Codes Used For Sorting

Programmers may be surprised when they sort an array or list, to find that the sorted list is not what they expected. For example, if the list, a,2,B,q,and "9" is sorted in Excel, the order becomes 2, "9", a, B, q. Sorting in C, however, the order becomes 2,"9", a, q, B.

Note that "9" is the character that represents the number nine, not the number nine itself. Also, it is useful to know that the lower case letters have a lower ASCII value than the upper case letters.

ASCII Codes For Punctuation and Special Characters

These are shown in Figure 3. The lowest numerical value in ASCII for the keyboard characters is 32, used for the space bar character. Figure 3 also gives the name of some special keyboard characters such as "~" (Tilde), "&" (Ampersand) and "^" (Caret).

ASCII Codes For Currency, Math, and Business Symbols

Figure 4 shows the ASCII codes used for some currencies like the dollar, yen, and euro. These are useful when trying to print symbols that do not exist on the users keyboard. Business symbols like the "Trademark" (TM) and others are also shown. To get the Euro symbol in Excel, the function is:

=CHAR(128)

The same can be achieved by holding down the "Alt" key and then typing 0128 using the numbers on the right hand side of the keyboard. Any of the characters shown can be produced using a similar process. e.g. The symbol for division ( ÷ ) can be obtained using Alt and 0247.

Figure 5 shows the ASCII codes and decimal and binary numbers for the characters not included in Figures 1 to 4.

Summary of Decimal to Binary Conversion and ASCII Character Values

ASCII is one of the coding methods used in computing, and can be easily translated into EBCDIC and other code forms. An easy look-up reference for binary to decimal conversion and vice versa are shown in this article, along with the Microsoft Excel functions that calculate any other numbers needed. Several other uses for the codes are shown, along with a description of how sort order is affected, and how to get a character into a cell in Microsoft Excel, and not just a format.

Related Articles

Binary is important in computing because data stored on memory devices are stored in binary, regardless of whether the storage medium is Hard Disk Drive using magnetics or CD / DVD using Phase Change Materials or Pits and Bumps. These articles give more details of why ASCII is used.


The copyright of the article ASCII Codes For Common Keyboard Characters in Computer Programming is owned by Martin Bell. Permission to republish ASCII Codes For Common Keyboard Characters in print or online must be granted by the author in writing.


Figure 1 - ASCII Codes For Number Digits, M Bell
Figure 2 - ASCII Codes For Letters, M Bell
Figure 3 - Punctuation and Other Keyboard, M Bell
Figure 4 - Math, Currency and Business, M Bell
Figure 5 - Other ASCII Characters, M Bell


Post this Article to facebook Add this Article to del.icio.us! Digg this Article furl this Article Add this Article to Reddit Add this Article to Technorati Add this Article to Newsvine Add this Article to Windows Live Add this Article to Yahoo Add this Article to StumbleUpon Add this Article to BlinkLists Add this Article to Spurl Add this Article to Google Add this Article to Ask Add this Article to Squidoo