Keyboard symbols for programming
Code uses every symbol on the keyboard, and most typing practice ignores them. This reference lists all 32 symbols on a standard keyboard: what each one is called, where to find it and what it does in common programming languages.
Before you start: layouts and names
Key positions below are for the standard US QWERTY layout. On UK and other ISO keyboards several symbols move: " and @ swap places (Shift + 2 and Shift + apostrophe), # gets its own key next to Enter, and \ and | move next to the left Shift. Names vary too: # is usually a "hash" in the UK and a "pound sign" or "number sign" in the US, and . is a "full stop", a "period" or, in code, simply a "dot".
All 32 symbols
| Symbol | Name | US key | Common uses in code |
|---|---|---|---|
~ | Tilde | Shift + ` | Bitwise NOT in C-family languages; your home folder in Bash (~/); part of Lua's not-equal (~=) and Perl's match operator (=~). |
` | Backtick, grave accent | ` (left of 1) | Template strings in JavaScript and TypeScript; inline code in Markdown; command substitution in older shell scripts. |
! | Exclamation mark, "bang" | Shift + 1 | Logical NOT (!done) and not-equal (!=); macros in Rust (println!). |
@ | At sign | Shift + 2 | Decorators in Python; annotations in Java and Kotlin; @main in Scala; arrays in Perl; instance variables in Ruby. |
# | Hash, number sign, pound sign | Shift + 3 | Comments in Python, Ruby, Bash, Perl and Elixir; preprocessor lines in C and C++ (#include); length in Lua (#list); interpolation in Ruby and Elixir (#{name}). |
$ | Dollar sign | Shift + 4 | Variables in PHP, Perl and Bash ($name); string interpolation in Kotlin and Dart; function application in Haskell. |
% | Percent sign | Shift + 5 | Remainder, or modulo (i % 3); format codes in C's printf (%d); hashes in Perl. |
^ | Caret | Shift + 6 | Bitwise XOR in most C-family languages; powers in Lua and Haskell (2 ^ 10); start of a line in regular expressions. |
& | Ampersand | Shift + 7 | Logical AND (&&); addresses and references in C, C++ and Go (&x); borrows in Rust (&mut); the capture operator in Elixir. |
* | Asterisk, star | Shift + 8 | Multiplication; pointers in C, C++ and Go (*Node); unpacking in Python (*args). |
( ) | Parentheses, round brackets | Shift + 9, Shift + 0 | Calling and defining functions; grouping in expressions; conditions in C-style if and for; tuples in Python, Rust and Swift. |
- | Hyphen, minus sign | - | Subtraction and negative numbers; -- to decrement, or to start a comment in Lua and Haskell; arrows (->); command-line options (ls -la). |
_ | Underscore | Shift + - | snake_case names (in_order); "ignore this" in Rust, Go, Scala and Elixir patterns; Python's __init__. |
= | Equals sign | = | Assignment (x = 1); comparison when doubled (==) or tripled (===); part of =>, <= and >=. |
+ | Plus sign | Shift + = | Addition; joining strings in Java, JavaScript and Python; ++ to increment in C-family languages, or to join lists in Haskell and Elixir. |
[ ] | Square brackets | [ and ] | Arrays and lists, and indexing (list[0]); generic types in Scala (List[Int]); tests in Bash ([[ ... ]]). |
{ } | Curly brackets, braces | Shift + [ and ] | Blocks of code in C-family languages; objects, maps and sets; tuples in Elixir; placeholders in Rust and Python format strings. |
\ | Backslash | \ (above Enter) | Escape sequences in strings (\n, \t); continuing a line in Bash and Python; lambdas in Haskell (\x -> x + 1). |
| | Pipe, vertical bar | Shift + \ | Bitwise OR, and logical OR when doubled (||); pipelines in Bash; guards in Haskell; union types in TypeScript; block parameters in Ruby and closures in Rust (|x|); the pipe operator in Elixir (|>). |
; | Semicolon | ; | The end of a statement in C, C++, Java, C#, JavaScript, PHP, Rust and more; separating commands on one line in Bash. |
: | Colon | Shift + ; | The end of a block line in Python; type annotations in TypeScript, Kotlin, Swift, Rust and Scala; paths (::) in C++ and Rust; declarations in Go (:=); symbols in Ruby and atoms in Elixir (:ok). |
' | Single quote, apostrophe | ' | Strings in Python, JavaScript, Dart, Ruby and PHP; single characters in C, C++, Java, C# and Rust ('a'). |
" | Double quote | Shift + ' | Strings in almost every language. In C, Java, C#, Go and Rust, strings take double quotes and single quotes are for single characters. |
, | Comma | , | Separating arguments, parameters and list items. |
. | Full stop, period, dot | . | Reaching a member (console.log, self.value); decimal points; ranges (1..10); joining strings in PHP and Perl; function composition in Haskell. |
< > | Angle brackets, less-than and greater-than | Shift + , and Shift + . | Comparisons; generic types (List<Integer>); #include <stdio.h>; arrows (->, =>); stream output in C++ (<<); redirection in Bash. |
/ | Slash, forward slash | / | Division; comments (// and /* */); file paths and URLs. |
? | Question mark | Shift + / | The conditional operator (a ? b : c); optional and nullable types in Kotlin, Swift, C#, Dart and TypeScript; error propagation in Rust; method names like nil? in Ruby. |
The symbols that trip people up
Backslash and slash
The forward slash / leans forwards and lives next to the right Shift; the backslash \ leans backwards and sits above Enter on US keyboards. Slashes are for division, comments and paths; backslashes are for escape sequences like \n.
Brackets
Round ( ), square [ ], curly { } and angle < > brackets all mean different things, and each language has its own rules. In Scala, generic types use square brackets (List[Int]) where Java uses angle brackets (List<Integer>). Typing the wrong kind is one of the most common slips in code.
Apostrophe and backtick
The apostrophe ' is next to Enter; the backtick ` is at the top left, under Esc. They look alike in some fonts but do completely different jobs.
Hyphen and underscore
Both are on the same key. Names in snake_case need the underscore, which means Shift; command-line options and subtraction use the plain hyphen.
Practise them in real code
Reading a table helps, but your fingers learn by doing. Every program in the test uses these symbols the way real code does, from the -> arrows in C to the |> pipes in Elixir. For finger positions and practice tips, see how to type code faster.