Finding ASCII Codes

by Sep 8, 2016

Here is an easy way to find the ASCII code for any character you may have scraped from a website, or found in a script that you copied from the internet.

Simply open a PowerShell, and enter this:

# paste character(s)  inside the quotes 
$text = ''
foreach($char in [char[]]$text)
  'Character {0,-3} Decimal {1,-5} Hex {1,-4:X}' -f $char, [int]$char

Next, paste the character(s) inside the quotes, and run the code. To test-drive, run the following command in PowerShell:

PS C:\> charmap

This opens the character map where you can pick a font, like DingBats for example, and one or more characters. Copy them to the clipboard, then paste them into the PowerShell code above. When you run the code, it returns the ASCII values for the selected characters in decimal and hex form. They should match the values found in the status bar of the character mapper utility.

Twitter This Tip! ReTweet this Tip!