Cambia Research - Supporting the Microsoft .NET Developer Community Supporting the Microsoft .NET Developer Community  

     | Home  | Articles  | Categories  | Coders  | Search  | Submit  | Contact Us    
Any inaccuracies in this index may be explained by the fact that it has been sorted with the help of a computer. --Donald Knuth

Share Your Knowledge! -- Create and submit your articles the easy way with WebWriter.

Updated:02:16 AM CT Jan 11, 2007
Posted:02:13 AM CT Jan 11, 2007

Javascript Char Codes (Key Codes)

Interactive Demonstration and Lookup Table

Author: Steve Lautenschlager

ReferenceText and StringsJavascriptBrowsers

 Summary

Javascript is often used on the browser client side to perform simple tasks that would otherwise require a full postback to the server. Many of those simple tasks involve processing text or characters entered into a form element on a web page, and it is often necessary to know the javascript keycode associated with a character. Here is a reference.
Press a key in the text box below to see the corresponding Javascript key code. Or scroll down to see the full list.

   
Key Pressed Javascript Key Code
backspace 8
tab 9
enter 13
shift 16
ctrl 17
alt 18
pause/break 19
caps lock 20
escape 27
page up 33
page down 34
end 35
home 36
left arrow 37
up arrow 38
right arrow 39
down arrow 40
insert 45
delete 46
0 48
1 49
2 50
3 51
4 52
5 53
6 54
7 55
8 56
9 57
a 65
b 66
c 67
d 68
e 69
f 70
g 71
h 72
i 73
j 74
k 75
l 76
m 77
n 78
o 79
p 80
q 81
r 82
s 83
t 84
u 85
v 86
w 87
x 88
y 89
z 90
left window key 91
right window key 92
select key 93
numpad 0 96
numpad 1 97
numpad 2 98
numpad 3 99
numpad 4 100
numpad 5 101
numpad 6 102
numpad 7 103
numpad 8 104
numpad 9 105
multiply 106
add 107
subtract 109
decimal point 110
divide 111
f1 112
f2 113
f3 114
f4 115
f5 116
f6 117
f7 118
f8 119
f9 120
f10 121
f11 122
f12 123
num lock 144
scroll lock 145
semi-colon 186
equal sign 187
comma 188
dash 189
period 190
forward slash 191
grave accent 192
open bracket 219
back slash 220
close braket 221
single quote 222

Add New Comment
Print Screen Key
joy01 Mar 07, 23:01Reply 
re: Print Screen Key
johnson24 Jan 08, 22:13Reply 
re: Print Screen Key
joe15 Dec 08, 15:58Reply 
<quote>"Prnt Scrn SysRq " key code equals ?...
sambit30 Aug 09, 11:50Reply 
re: Print Screen Key
mmm17 Dec 09, 21:41Reply 
re: Print Screen Key
Ramana10 Feb 10, 8:21Reply 
re: Print Screen Key
Steve Lautenschlager01 Mar 07, 23:01Reply 
re: Print Screen Key
Shaheen03 Feb 09, 3:16Reply 
Space bar
Pat Markland13 Mar 07, 10:18Reply 
re: Space bar
Steve Lautenschlager13 Mar 07, 21:33Reply 
Javascript Char Codes (Key Codes)
Bill10 May 07, 21:17Reply 
re: Javascript Char Codes (Key Codes)
Adam17 May 07, 14:28Reply 
Thanks
Amit16 May 07, 9:58Reply 
re: Full Char Code Table
Rafael Fotnoura01 Jun 07, 9:17Reply 
re: Full Char Code Table (fixed)
Seryoga24 Jul 08, 5:37Reply 
re: Full Char Code Table (ARGH!!! It eats table tags!)
Seryoga24 Jul 08, 5:39Reply 
re: Full Char Code Table
Seryoga24 Jul 08, 5:42Reply 
Javascript Char Codes (Key Codes)
Atmaram11 Jun 07, 7:33Reply 
Semi-colon is 186 and *59*
Derek Detweiler02 Aug 07, 15:10Reply 
re: Semi-colon is 186 and *59*
Steve Lautenschlager02 Aug 07, 21:38Reply 
Javascript Char Codes (Key Codes)
cante07 Nov 07, 22:31Reply 
re: Javascript Char Codes (Key Codes)
lotuzwine22 Nov 07, 7:42Reply 
re: Javascript Char Codes (Key Codes)
Quaza09 Jan 08, 11:15Reply 
re: Javascript Char Codes (Key Codes)
Jason Miller14 Mar 08, 15:52Reply 
Scroll Wheel?
Will15 Apr 08, 5:52Reply 
re: Scroll Wheel?
Benjamin M. A'Lee17 Sep 08, 8:34Reply 
Browser Dependency
Jonathan Tang19 Oct 08, 13:57Reply 
Javascript Char Codes (Key Codes)
tom14 Jan 09, 21:18Reply 
re: Javascript Char Codes (Key Codes)
Fabio99908 Mar 09, 6:19Reply 
Javascript Char Codes (Key Codes)
nulll12 Mar 09, 16:22Reply 
missing code
ajay12 May 09, 7:49Reply 
re: missing code
Steve13 May 09, 10:12Reply 
Javascript Char Codes (Key Codes)
amir24 May 09, 6:27Reply 
About forward slash/period/other special characters having "wrong" cod
Anna05 Aug 09, 6:04Reply 
keycode 12 is missing
Anonymous29 Oct 09, 10:35Reply 
re: keycode 12 is missing
Steve Lautenschlager27 Jan 10, 13:08Reply 
Javascript Char Codes (Key Codes)
Devanand20 Jan 10, 1:04Reply 
Javascript Char Codes (Key Codes)
Coder27 Jan 10, 13:04Reply 
re: Javascript Char Codes (Key Codes)
Steve Lautenschlager27 Jan 10, 13:04Reply 
info back slash
vash09 Feb 10, 8:56Reply 
CR Comments by Cambia Research
advertisement
 
Steve Lautenschlager (steve)
Steve founded Cambia Research to augment his .NET hobby. Developing and maintaining the site combines his interests in technology, writing and education.


 
Copyright © Cambia Research 2002-2007. All Rights Reserved. steve [ at ] cambiaresearch.com