The backtick is a typographical mark used mainly in
computing
Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes, and development of both hardware and software. Computing has scientific, ...
. It is also known as backquote, grave, or grave accent.
The character was designed for typewriters to add a
grave accent to a (lower-case) base letter, by overtyping it atop that letter. On early computer systems, however, this physical
dead key
A dead key is a special kind of modifier key on a mechanical typewriter, or computer keyboard, that is typically used to attach a specific diacritic to a base letter. The dead key does not generate a (complete) character by itself, but modifies t ...
+overtype function was rarely supported, being functionally replaced by
precomposed character
A precomposed character (alternatively composite character or decomposable character) is a Unicode entity that can also be defined as a sequence of one or more other characters. A precomposed character may typically represent a letter with a diacri ...
s. Consequently, this ASCII symbol was rarely (if ever) used in computer systems for its original aim and became repurposed for many unrelated uses in computer programming.
The sign is located on the left-top of a US or UK layout keyboard, next to the key. On older keyboards the
Escape key
On computer keyboards, the Esc key (named ''Escape key'' in the international standard series ISO/IEC 9995) is a key used to generate the escape character (which can be represented as ASCII code 27 in decimal, Unicode U+001B, or ). The escape ...
was at this location, and the backtick key was somewhere on the right side of the layout. Provision (if any) of the backtick on other keyboards varies by national
keyboard layout
A keyboard layout is any specific physical, visual or functional arrangement of the keys, legends, or key-meaning associations (respectively) of a computer keyboard, mobile phone, or other computer-controlled typographic keyboard.
is the actua ...
and
keyboard mapping
A keyboard layout is any specific physical, visual or functional arrangement of the keys, legends, or key-meaning associations (respectively) of a computer keyboard, mobile phone, or other computer-controlled typographic keyboard.
is the actua ...
.
History
Typewriters
On typewriters designed for languages that routinely use
diacritic
A diacritic (also diacritical mark, diacritical point, diacritical sign, or accent) is a glyph added to a letter or to a basic glyph. The term derives from the Ancient Greek (, "distinguishing"), from (, "to distinguish"). The word ''diacriti ...
s (accent marks), there are two possible solutions. Keys can be dedicated to pre-composed characters or alternatively a
dead key
A dead key is a special kind of modifier key on a mechanical typewriter, or computer keyboard, that is typically used to attach a specific diacritic to a base letter. The dead key does not generate a (complete) character by itself, but modifies t ...
mechanism can be provided. With the latter, a mark is made when a dead key is typed but, unlike normal keys, the paper carriage does not move on and thus the next letter to be typed is printed under the accent.
Incorporation into ISO 646 and ASCII
The incorporation of the grave symbol into ASCII is a consequence of this prior existence on typewriters. This symbol did not exist independently as a
type or
hot-lead printing character.
Thus ISO646 was born and the ASCII standard updated to include the backtick and other symbols.
As surrogate of apostrophe or (opening) single quote
Some early typewriters and ASCII peripherals designed the backtick and apostrophe to be mirror images of each other. This allowed them to be used as matching pairs of open and close quotes, and also as grave and acute accents, and allowed the apostrophe to be used as a prime. None of these were considered typographically correct.
The use of apostrophe for opening quotes, the need on some typewriters to overprint apostrophe and period to get an exclamation mark, and the lack of a mirrored double-quote character, tended to change the apostrophe to the modern "typewriter" design that is vertical, so this no longer works. Unicode now provides separate characters for opening and closing quotes.
Such style is sometimes used even nowadays; examples are: output generated by some UNIX console programs, rendering of
man pages
A man page (short for manual page) is a form of software documentation usually found on a Unix or Unix-like operating system. Topics covered include computer programs (including library and system calls), formal standards and conventions, and ev ...
within some environments, technical documentation written long ago or written in old-school manner. However, as time goes on, such style is used less and less, and even institutions that traditionally were using that style are now abandoning it.
Computing
Command-line interface languages
Many
command-line interface languages and the
scripting (programming) languages like
Perl
Perl is a family of two high-level, general-purpose, interpreted, dynamic programming languages. "Perl" refers to Perl 5, but from 2000 to 2019 it also referred to its redesigned "sister language", Perl 6, before the latter's name was offic ...
,
PHP
PHP is a general-purpose scripting language geared toward web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1993 and released in 1995. The PHP reference implementation is now produced by The PHP Group. ...
,
Ruby
A ruby is a pinkish red to blood-red colored gemstone, a variety of the mineral corundum ( aluminium oxide). Ruby is one of the most popular traditional jewelry gems and is very durable. Other varieties of gem-quality corundum are called ...
and
Julia
Julia is usually a feminine given name. It is a Latinate feminine form of the name Julio and Julius. (For further details on etymology, see the Wiktionary entry "Julius".) The given name ''Julia'' had been in use throughout Late Antiquity (e.g ...
(though see below) use pairs of backticks to indicate
command substitution
In computing, command substitution is a facility that allows a command to be run and its output to be pasted back on the command line as arguments to another command. Command substitution first appeared in the Bourne shell, introduced with Version ...
. A command substitution is the
standard output
In computer programming, standard streams are interconnected input and output communication channels between a computer program and its environment when it begins execution. The three input/output (I/O) connections are called standard input (stdin ...
from one command, into an embedded line of text within another command. For example, using $ as the symbol representing a terminal prompt, the code line:
:
on execution, produces the output:
:
In
Bash shell
Bash is a Unix shell and command language written by Brian Fox for the GNU Project as a free software replacement for the Bourne shell. First released in 1989, it has been used as the default login shell for most Linux distributions. Bash was o ...
and
Z shell
The Z shell (Zsh) is a Unix shell that can be used as an interactive login shell and as a command interpreter for shell scripting. Zsh is an extended Bourne shell with many improvements, including some features of Bash, ksh, and tcsh.
History ...
the use of backticks for command substitution is now largely deprecated in favor of the notation
$(...)
, so that one of the examples above would be re-written:
:
The new syntax allows nesting, for example:
:
Markup languages
It is sometimes used in
source code comments to indicate code, e.g.,
:
/* Use the `printf()` function. */
This is also the format the
Markdown
Markdown is a lightweight markup language for creating formatted text using a plain-text editor. John Gruber and Aaron Swartz created Markdown in 2004 as a markup language that is appealing to human readers in its source code form. Markdown i ...
formatter uses to indicate code. Some variations of Markdown support "fenced code blocks" that span multiple lines of code, starting (and ending) with three backticks in a row (
```
).
*
TeX
Tex may refer to:
People and fictional characters
* Tex (nickname), a list of people and fictional characters with the nickname
* Joe Tex (1933–1982), stage name of American soul singer Joseph Arrington Jr.
Entertainment
* ''Tex'', the Italian ...
: The backtick character represents curly opening quotes. For example,
`
is rendered as single opening curly quote () and
``
is a double curly opening quote (). It also supplies the numeric ASCII value of an ASCII character wherever a number is expected.
Programming languages
*
BBC BASIC
BBC BASIC is a version of the BASIC programming language released in 1981 as the native programming language for the BBC Micro home/personal computer, providing a standardized language for a UK computer literacy project of the BBC. It was wr ...
: The backtick character is valid at the beginning of or within a variable, structure, procedure or function name.
*
D and
Go: The backtick surrounds a
raw string literal.
*
F#: Surrounding an identifier with double backticks allows the use of identifiers that would not otherwise be allowed, such as keywords, or identifiers containing punctuation or spaces.
*
Haskell
Haskell () is a general-purpose, statically-typed, purely functional programming language with type inference and lazy evaluation. Designed for teaching, research and industrial applications, Haskell has pioneered a number of programming lan ...
: Surrounding a function name by backticks makes it an
infix operator
Infix notation is the notation commonly used in arithmetical and logical formulae and statements. It is characterized by the placement of operators between operands—" infixed operators"—such as the plus sign in .
Usage
Binary relations a ...
.
*
JavaScript
JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of websites use JavaScript on the client side for webpage behavior, of ...
:
ECMAScript 6 standard introduced a "backtick" character which indicated a string or template literal. Its applications include (but are not limited to): string interpolation (substitution), embedded expressions, and multi-line strings. In the following example
name
and
pet
variable's values get substituted into the string enclosed by grave accent characters:
::
const name = "Mary", pet = "lamb"; //
let temp = `$ has a little $!`;
console.log(temp);
// => "Mary has a little lamb!";
*
Lisp macro systems: The backtick character (called ''quasiquote'' in
Scheme) introduces a quoted expression in which comma-substitution may occur. It is identical to the plain quote, except that a nested expression prefixed with a
comma is replaced with the value of that nested expression. If the nested expression happens to be a symbol (that is, a variable name in Lisp), the symbols' value is used. If the expression happens to be program code, the first value returned by that code is inserted at the respective location instead of the comma-prefixed code. This is roughly analogous to the Bourne shell's
variable interpolation
In computer programming, string interpolation (or variable interpolation, variable substitution, or variable expansion) is the process of evaluating a string literal containing one or more placeholders, yielding a result in which the placeholders ...
with
$
inside double quotes.
*
Julia
Julia is usually a feminine given name. It is a Latinate feminine form of the name Julio and Julius. (For further details on etymology, see the Wiktionary entry "Julius".) The given name ''Julia'' had been in use throughout Late Antiquity (e.g ...
: Backticks make a command object,
Cmd
, that can be run, with run function, like
run(`echo Hello world!`)
. You can interpolate Julia variables, but only indirectly shell environment variables.
*
m4: A backtick together with an apostrophe quotes strings (to suppress or defer macro expansion).
*
MySQL
MySQL () is an open-source relational database management system (RDBMS). Its name is a combination of "My", the name of co-founder Michael Widenius's daughter My, and "SQL", the acronym for Structured Query Language. A relational database ...
: A backtick in queries is a delimiter for column, table, and database identifiers.
*
OCaml: The backtick indicates polymorphic variants.
*
Pico
Pico may refer to:
Places The Moon
* Mons Pico, a lunar mountain in the northern part of the Mare Imbrium basin
Portugal
* Pico, a civil parish in the municipality of Vila Verde
* Pico da Pedra, a civil parish in the municipality of Ribeir ...
: The backtick indicates comments in the programming language.
*
PowerShell
PowerShell is a task automation and configuration management program from Microsoft, consisting of a command-line shell and the associated scripting language. Initially a Windows component only, known as Windows PowerShell, it was made open-sou ...
: The backtick is used as the escape character. For example, a newline character is denoted
`n
. Most common programming languages use a backslash as the escape character (e.g.,
\n
), but because Windows allows the backslash as a path separator, it is impractical for PowerShell to use backslash for a different purpose. Two backticks produce the
`
character itself. For example, the
nullable boolean of
.NET is specified in PowerShell as
ullable``1[System.Boolean
.
*_Python_(programming_language).html" "title="ystem.Boolean.html" ;"title="ullable``1[System.Boolean">ullable``1[System.Boolean.
* Python (programming language)">Python
Python may refer to:
Snakes
* Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia
** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia
* Python (mythology), a mythical serpent
Computing
* Python (pro ...
function, which converts its argument to a string suitable for a programmer to view. However, this feature was removed in Python 3.0. Backticks also appear extensively in the reStructuredText plain text markup language (implemented in the Python docutils package).
* R (programming language), R: The backtick is used to surround non-syntactic variable names. This includes variable names containing special characters or
, among others.
: An identifier may also be formed by an arbitrary string between backticks. The identifier then is composed of all characters excluding the backticks themselves.
*
: The backtick is used at the beginning of compiler's directives.
. This is true for games such as ''
.
While not necessarily the original progenitor of the console key concept, ''Quake'' is still widely associated with any usage of the key as a toggle for a drop-down console, often being referred to as the "Quake Key". In 2021, Microsoft Powershell introduced a "Quake Mode" which enables a global shortcut of Meta+ (with a predictable result).