The ampersand ( & ) symbol, also known as the “epershand” or “and” symbol, is found above the number 7 key on a US QWERTY keyboard.

Where is the ampersand key on the keyboard?

Below is an overview of a computer keyboard with the ampersand key highlighted in blue.

  • Where is the ampersand key on the keyboard?
  • How to create the & symbol.
  • What is an ampersand used for on a computer?
  • Related information.
  • Keyboard help and support.

How to create the & symbol

Creating the & symbol on a U.S. keyboard

To create the ampersand symbol using a U.S. keyboard, hold down the Shift and press the 7 key on the top of the keyboard.

Creating the & symbol on a smartphone or tablet

To create an ampersand on an Android or Apple smartphone or tablet, open the keyboard, go into the numbers (123) or symbols (sym) section, and tap the & symbol.

Doing the Alt code Alt+38 can also create an ampersand.

What is an ampersand used for on a computer?

In literature or English text, the ampersand is used as shorthand to mean “and,” as in “John & Rob went to the baseball game.” It is also used in programming languages, including Visual Basic (to combine variables and literal text), C++ (denoting an address in memory) and Perl (to call a user-defined subroutine). It can also be used in Excel spreadsheet formulas to combine several values (cells) into a single value (cell) and in HTML for extended HTML characters.

Excel formula example

In the example below, Cell D2 is being made a full name by taking everything in A2, B2, and CD using the ampersand.

  • Excel formula example
  • Boolean AND operator
  • HTML extended character example
  • URL example
  • Perl example
  • Visual Basic example
  • Related information

Boolean AND operator

Many programming languages use two ampersands next to each other as a Boolean AND operator. For example, in the below code, if the variables $computer and $hope are equal to “1,” then a message is printed. However, if either variables are not equal to “1” then nothing is printed.

if (($computer == 1) && ($hope == 1)) { print “Both variables are equal to one.”; }

HTML extended character example

When creating a web page, some characters (all shown on extended HTML characters page) require an extended character code to be correctly seen. For example, because quotes (") are used in HTML, to add a quote to a web page’s text you need to use the extended HTML code " in the HTML code. All extended HTML character codes begin with an ampersand and end with a semicolon.

Also, the ampersand itself must also use an extended character code. In other words, if you wanted to show “&” on an HTML web page, you would need to use the code & in HTML.

URL example

Within a URL the ampersand is used to separate variables. For example, in the example below there are two different variables, “q” that equals “example search” and “example” that equals “test”. These variables can be read by the search.cgi script and used to perform different functions. See our URL definition for further information and a breakdown of URLs.

https://www.computerhope.com/cgi-bin/search.cgi?q=example%20search&example=test

Perl example

In the below Perl example, the subroutine “sayhello” is being called with the &sayhello; command. When this code is executed, it prints “hello” to the screen.

&sayhello; sub sayhello { print “hello”; }

Visual Basic example

In the below Visual Basic example, the variable vFullName is being assigned the vFirst and vLast variables to create a variable with the full name.

dim vFirst as string dim vLast as string dim vFullName as string vFirst = “John” vLast = “Smith” vFullName = vFirst & " " & vLast

Boolean, Keyboard terms, Number key, Operator

  • Computer keyboard key explanations.
  • Keyboard help and support.