Updated: 04/26/2017 by Computer Hope

BracketsSometimes referred to as square brackets, a bracket is a punctuation mark typically found in pairs. There are two types of brackets: the open bracket ( [ ) and the closed bracket ( ] ). The open bracket has an open end towards the right, and the closed bracket has an open end towards the left. Brackets are the two keys found to the right of the P key on a US QWERTY keyboard.

Where are the square bracket keys on the keyboard?

Below is an overview of a computer keyboard with the open square bracket and close bracket keys highlighted in blue.

Bracket key

How to create an open and close square bracket

Creating the '[' and ']' symbols on a U.S. keyboard

On English keyboards the open bracket and close bracket are on the same key as the curly bracket keys close to the Enter key.

Note: If you are pressing and holding the Shift key while pressing the square bracket key you will get a curly bracket.

Creating the '[' and ']' symbol on a smartphone or tablet

To create an open and close bracket a smartphone or tablet open the keyboard and go into the numbers (123) and then (#+=) or symbols (sym) section and then press your finger on the '[' or ']' symbol.

How are brackets used?

  • Basic textual manner to add additional or missing details ("It was an honor to do it [the presentation].")
  • Regular expressions, wildcards, SQL, Visual Basic, C#, and JavaScript programming languages to enclose characters for string validation, pattern matching, or to build arrays.
  • Used in standard mathematical notation for intervals and floor functions, as well as in the Lie bracket and Iverson bracket.

Regular expression bracket example

$value = s/[a-z]/-/ig;

This example replaces any character 'a' through 'z' in the $value variable with a hyphen.

JavaScript programming bracket example

var myList = new Array();
myList[0] = "value1";
myList[1] = "value2";
myList[2] = "value3";

SQL programming bracket example

FROM customers
WHERE name LIKE '[M-Z]inger'

Curly bracket, Keyboard terms, Programming terms