Where braces are used
Braces almost never appear in ordinary prose. Their home is code and math:
- Code blocks: C, C++, Java, JavaScript, C# and many other languages wrap function bodies, loops and conditions in braces.
- JSON and objects:
{"name": "Ava", "age": 9}is a JSON object. - CSS: each rule’s declarations sit inside braces:
p { margin: 0; }. - Templates and placeholders:
Hello, {name}in many template systems,${total}in JavaScript template literals,{{ title }}in Jinja-style templates. - Set notation: {1, 2, 3} is the set containing 1, 2 and 3, and {} is the empty set.
- Regular expressions:
a{2,4}matches two to four a’s in a row. - Piecewise functions: one tall left brace groups the cases.
Braces, brackets and parentheses
American and British English name these differently, which causes mix-ups:
| Shape | US name | Also called |
|---|---|---|
| ( ) | parentheses | round brackets; “brackets” in the UK |
| [ ] | brackets | square brackets |
| { } | braces | curly brackets, curly braces |
| ⟨ ⟩ | angle brackets | chevrons |
In regular writing, braces have no job. If you need an aside inside parentheses, use square brackets, not braces: (see the 2023 report [page 12]). ⦃ ⦄ (white curly brackets) are a separate pair used in some math notation.
Typing braces on phones and in LaTeX
- iPhone: open the numbers keyboard, then tap #+=. Braces are on the top row.
- Android (Gboard): on the second symbols page.
- LaTeX: braces group arguments, so a plain
{prints nothing. Use\{and\}for literal braces, as in\{1, 2, 3\}, and\left\{for a tall brace. - Word: Insert > Equation offers braces that stretch for piecewise functions.
- Format strings: in Python f-strings and in C#
String.Format, double the brace to print it:{{gives {.
Frequently asked questions
How do I type curly brackets?
On a US keyboard, hold Shift and press [ for { or ] for }. The keys are to the right of P.
What is the difference between brackets and braces?
In US usage, brackets are square [ ], braces are curly { }, and parentheses are round ( ).
What do curly brackets mean in math?
They enclose the elements of a set, as in {2, 4, 6}.
Why do my braces disappear in LaTeX?
LaTeX uses braces for grouping. Type { and } to print them.
Unicode data: Unicode Character Database 18.0.0 (unicode.org).