Backtick
The backtick (), also known as the grave accent or backquote, is a typographical punctuation mark (Unicode U+0060) primarily utilized in computing and programming contexts to delimit code snippets, perform command substitution, and quote identifiers.[](https://www.fileformat.info/info/unicode/char/0060/index.htm) Originally designed for typewriters to overlay a grave accent diacritic onto lowercase letters, such as creating à by typing over a, it evolved into a versatile symbol on early computer systems for similar accentuation before gaining prominence in software development.[1]
In programming languages and shells, the backtick serves critical syntactic roles; for instance, in Unix-like shells like Bash, it enables command substitution, where content enclosed in backticks (e.g., date) is executed and its output replaces the substitution, allowing dynamic script behavior, though the modern ( ) form is now preferred for nesting and readability. Similarly, in [JavaScript](/page/JavaScript) (ES6 and later), backticks define template literals, which support multi-line strings and embedded expressions via {}, facilitating string interpolation without concatenation (e.g., Hello, ${name}!).[2]
Beyond scripting, backticks are essential in markup and database systems: in Markdown per the CommonMark specification, three or more consecutive backticks (```) create fenced code blocks for syntax-highlighted code display, while single backticks enclose inline code (e.g., print("Hello")), with escapes using additional backticks for nested instances. In MySQL, backticks quote schema object identifiers like table or column names, permitting reserved words or special characters (e.g., select as a table name) without ambiguity, especially under default SQL modes.[3] These applications underscore the backtick's role as a non-printing delimiter that enhances code legibility and functionality across diverse technical domains.
History
Origins in Typewriting
The backtick, also known as the grave accent mark (`), emerged in the early 20th century as a dedicated key on manual typewriters to enable the creation of grave accents on lowercase letters through overstriking. Typists would press the backtick key to imprint the accent, backspace to return the carriage to the same position, and then type the base letter, superimposing the mark above it to form characters like à or è. This approach addressed the limited character sets of early typewriters, which lacked dedicated keys for diacritics common in Romance languages such as French, Italian, and Portuguese.[1] The backtick key was integrated into English-language typewriter models, standardizing its use within QWERTY layouts for broader accessibility in multilingual contexts. Although English orthography rarely employs the grave accent, its inclusion facilitated typing in global trade, literature, and immigration documents during an era of increasing international communication.[4] Overstriking with the backtick posed practical difficulties due to the mechanical nature of typewriters, including challenges in precise alignment and potential ink issues from double impressions.Standardization in Early Computing Encodings
The backtick, designated as the "grave accent" in early standards, was formally included in the American Standard Code for Information Interchange (ASCII) under ASA X3.4-1963 at code position 96 (hex 60). This assignment reflected the influence of teletype machines, which adapted typewriter layouts to support efficient data transmission and printing in telecommunication systems. The X3 committee of the American Standards Association finalized the standard in June 1963, establishing a 7-bit encoding with 128 positions, where the grave accent filled a slot among punctuation and special symbols to address needs for diacritic representation in limited character sets.[5] The adoption of the grave accent in ASCII facilitated its transition from a typewriter accessory to a core element in digital encodings, particularly in mainframes of the 1960s. Early implementations appeared in systems like the IBM System/360 series, which supported ASCII alongside EBCDIC, allowing the character to function as an accent marker for overstriking in text output on line printers and terminals. Similarly, DEC's PDP series, starting with models compatible with 7-bit ASCII, incorporated it for basic text handling, though limited hardware often rendered it as non-printing or paired with base letters for accented forms in software. These integrations underscored the character's role in bridging analog typing conventions with binary data representation.[6] In 1967, the International Organization for Standardization (ISO) published ISO 646 (also known as ISO IRV), which retained the grave accent in its invariant set of 94 graphic characters to ensure compatibility with ASCII amid efforts to create a global 7-bit standard. National variants of ISO 646, such as those for French or German, substituted other positions for diacritics like acute accents or umlauts, but debates in ISO TC 97/SC 2 meetings—documented in reports from October 1963—highlighted tensions over allocating space for European language needs versus maintaining U.S.-centric symbols for international interchange. The retention of the grave accent prioritized interoperability in data exchange across borders, preventing fragmentation in early networked computing environments.[7]Evolution as a Punctuation Surrogate
In the 1960s and 1970s, many computer terminals and printers were designed with limited character sets derived from ASCII, often lacking dedicated keys for curved apostrophes or distinct opening single quotes, prompting the backtick to serve as a practical surrogate for the left single quotation mark. This adaptation arose from hardware constraints, where the backtick (ASCII 0x60) and apostrophe (ASCII 0x27) were sometimes rendered as near-mirror images on output devices to facilitate paired usage in text. RFC 20, published in 1969, explicitly named the backtick as "Grave Accent (Opening Single Quotation Mark)" and the apostrophe as "Apostrophe (Closing Single Quotation Mark; Acute Accent)," formalizing their roles in early network text interchange despite the limitations of basic teletype-style equipment.[8] Examples of this surrogate role appear in early software documentation and code comments from languages like FORTRAN and COBOL, where backtick-apostrophe pairs such as `variable' were commonly used to highlight terms, strings, or emphasis in listings printed on line printers or displayed on character-based terminals. This convention allowed for approximate typographic pairing in plain text without requiring additional glyphs, reflecting the ad-hoc solutions developers adopted for readable output in resource-constrained environments. The 1980s marked a shift with the adoption of extended ASCII encodings, such as IBM's code page 437 introduced for the IBM PC in 1981, which incorporated dedicated characters for left and right single quotation marks (e.g., at positions 0x91 and 0x92) alongside curved variants, thereby diminishing but not fully eradicating the backtick's surrogate applications in legacy systems and documentation.[9] This usage endured in hacker culture and plain-text email communications as a stylistic "opening quote" well into the 1990s, persisting due to compatibility with ASCII-only transports like Usenet, until the publication of Unicode 1.0 in October 1991 provided standardized, unambiguous distinctions between the grave accent, apostrophe, and true quotation marks.[10]Typography
Relation to Grave Accent and Diacritics
In Unicode, the backtick is classified as U+0060 GRAVE ACCENT, a spacing punctuation mark in the Basic Latin block primarily used in computing contexts, distinct from the non-spacing U+0300 COMBINING GRAVE ACCENT, which attaches directly to a base character as a diacritic to indicate features like the Greek varia or the fourth tone in Pinyin, and the spacing U+02CB MODIFIER LETTER GRAVE ACCENT, employed for phonetic modifications such as tone marks without combining.[11][12] These distinctions ensure proper rendering in multilingual text, where the backtick serves as a freestanding symbol rather than a true diacritic.[13] Historically, the backtick has been confused with the grave accent due to its inclusion in early character encodings like ASCII, where it approximated the diacritic for overstriking on typewriters to form accented letters such as Italian ò or French è, though this method produced suboptimal results in slanted typesetting because the backtick lacks the precise curvature and attachment of dedicated diacritics.[14][15] This approximation arose from practical limitations in mechanical printing, leading to its widespread but inaccurate use as a substitute in non-professional contexts.[16] Linguistically, the grave accent functions rarely as a standalone mark in modern languages, appearing instead primarily as a diacritic to denote open vowel sounds, stress, or distinctions in pronunciation, such as in French words like frère (è) or Italian più (ù).[17] In English, its standalone use is limited to poetry and verse, where it signals that a typically silent final vowel is pronounced for metrical purposes, as in learnèd to emphasize two syllables.[17][18] On keyboards, it often acts as a dead key in input methods, where pressing ` followed by a vowel like e generates the combined form è.[17] Typographically, the backtick's more vertical orientation contrasts with the slanted, backward-leaning design of the true grave diacritic (as in U+0300 or U+02CB), making it unsuitable for professional composition where diacritics must integrate seamlessly without disrupting text flow or visual harmony.[16][19] Style guides like the Chicago Manual of Style recommend retaining proper diacritics in loanwords and borrowed terms to preserve linguistic accuracy and readability, advising against approximations like the backtick that compromise typographic precision.[20][21] This critique underscores the backtick's role as a computational artifact rather than a refined typographic element.[22]Design Variations and Keyboard Placement
The design of the backtick glyph (Unicode U+0060, grave accent) varies across font families to enhance readability, particularly in technical contexts like code. In monospace fonts such as Courier, the glyph is typically rendered as a compact, vertically centered mark to align with fixed-width characters and operator symbols, ensuring clarity at small sizes for tasks like delimiting strings.[23] In sans-serif fonts like Arial, it integrates more fluidly with rounded forms, often appearing as a slanted line with subtle adjustments for proportional spacing, reflecting the shift from rigid typewriter-era representations to flexible digital typography optimized for screen display.[24] Keyboard placement of the backtick differs significantly by layout, affecting input ergonomics. On the US QWERTY keyboard, it occupies the top-left position adjacent to the "1" key and is typed unshifted for standalone use (Shift produces the tilde ~).[25] In contrast, on the French AZERTY layout, the key functions primarily as a dead key for composing grave accents (e.g., ` + e yields è), requiring a space or second press to insert the backtick alone, which can complicate direct entry.[26] Similarly, in the German QWERTZ layout, it serves as a dead key on the acute accent key (´, positioned to the left of Backspace near the top-right); press Shift + ´ followed by space to insert the standalone backtick.[27] On mobile devices, such as iOS and Android keyboards, the backtick is not prominent on the primary layout; it is accessed via the symbols menu (e.g., tapping 123 then #+= on iOS, or ?123 then =<> on Gboard for Android), prioritizing frequently used characters in limited space.[28][29][30] Rendering challenges with the backtick have persisted from early computing due to its dead key heritage, originating in typewriter conventions for diacritics. In text editors from the late 20th century onward, typing a backtick followed by space could cause the glyph to "disappear" temporarily, as the system awaited a base character for accent composition; pressing space alone would then insert it, but this led to input delays or errors in non-supporting environments.[31] Modern Unicode and UTF-8 encoding resolve many such issues by standardizing the glyph as a standalone spacing character (U+0060), eliminating legacy overtype behaviors in compliant editors and ensuring consistent display without composition waits. Accessibility considerations for the backtick involve how assistive technologies interpret it, distinct from its linguistic role as a grave accent diacritic. Screen readers like NVDA, JAWS, and VoiceOver typically announce it as "grave" when encountered in isolation or context, such as in code snippets, to convey its typographic identity without confusion.[32][33] For web elements containing backticks—such as inline code or buttons—ARIA attributes like aria-label can provide explicit descriptions (e.g., aria-label="backtick symbol" on a code span) to override ambiguous readings, ensuring screen users receive clear, contextual announcements while maintaining semantic integrity.[34]Computing Applications
Command Substitution in Shells
The backtick () was introduced as the delimiter for command substitution in the [Bourne shell](/page/Bourne_shell), developed at [AT&T](/page/AT&T) Bell Laboratories and documented in 1977. This feature enables the shell to execute a command enclosed within backticks and substitute its standard output directly into the surrounding command line or script, facilitating dynamic content generation. For instance, executing echo `date`` replaces the backticked portion with the current date and time, producing output such as "Sat Nov 8 14:30:00 UTC 2025".[35]
In terms of syntax, the command to be substituted must be placed between matching backticks, with the resulting output undergoing field splitting and pathname expansion unless the entire substitution is quoted. Escaping a literal backtick inside the substitution requires a backslash (\``), as unescaped backticks would prematurely terminate the construct. Nesting backtick substitutions is supported but challenging due to the [need to](/page/Need_To) escape inner backticks (e.g., echo echo \date``), which can lead to obscure and error-prone code; this limitation stems from the original Bourne shell design and persists in POSIX-compliant implementations.[35][36]
Examples of backtick usage abound in scripts for shells like Bash and Zsh, which inherit Bourne shell compatibility. A typical case assigns command output to a variable, such as files=ls`` to capture a directory listing (though ls is generally discouraged in scripts due to parsing issues with filenames containing spaces; files=$(ls) is preferable in modern practice). Another historical example from early Unix scripting at AT&T involves looping over sorted files: for i in ls -t; do command $i; done, processing files in timestamp order. These patterns trace back to the 1970s development of Unix Version 7, where the Bourne shell became the standard interactive environment.[35][36]
Despite ongoing support, backtick substitution has trended toward deprecation in favor of the (command) syntax since the [1990s](/page/1990s), following its [introduction](/page/Introduction) in the Korn shell during the 1980s to improve nesting (e.g., `echo (date $(locale date_fmt))`) and quoting consistency. The shift emphasizes readability in contemporary scripting, as backticks suffer from legacy quoting ambiguities. Backticks nevertheless endure in legacy codebases from early Unix systems for compatibility reasons.[37][36]
Syntax in Programming Languages
The backtick () has played a significant role in the syntax of various programming languages, primarily for quoting mechanisms, command execution, and [string interpolation](/page/String_interpolation). In [Lisp](/page/Lisp) dialects, starting from implementations like Maclisp in the late [1970s](/page/1970s), the backtick serves as the quasiquotation operator, allowing developers to quote expressions while selectively evaluating subexpressions using [comma](/page/Comma) (,) for unquoting. This feature, denoted as expr`, prevents full evaluation of the quoted form, enabling powerful metaprogramming by treating code as data with controlled substitutions.[38]
In Perl, introduced in version 1.0 in 1987, backticks execute system commands and capture their output as a string, similar to shell command substitution but integrated into the language's quoting operators. For example, the expression ls runs the ls command and returns its stdout. This syntax, equivalent to the qx// operator, facilitated seamless interaction with external processes from early on.
AWK, developed in 1977 at Bell Labs, allows the output of shell commands to be embedded using pipes in expressions, such as in getline operations like "ls | getline". This usage marked an early evolution of dynamic content generation in text-processing languages, though without backticks.[39]
In modern languages, JavaScript adopted backticks in ECMAScript 2015 (ES6) for template literals, enabling multi-line strings and interpolation with {expressions}, as in `` `Hello {name}` ``. This feature improved readability for dynamic strings compared to concatenation.[2]
Rust's procedural macro system relies on quasiquotation via the quote crate, which provides a syntax for generating code tokens while interpolating variables, drawing from Lisp traditions to support hygienic macro expansion without direct backtick usage in core syntax.
Variations exist across languages; Python treated backticks as an alias for the repr() function until its deprecation in Python 3.0 (2008), after which they became plain literal characters with no special syntactic role. In C and similar languages like C++, the backtick has historically lacked dedicated syntax, functioning solely as a punctuation mark that requires escaping in strings (e.g., "`").[40]
The backtick's syntactic evolution reflects a shift from command-like execution in 1970s tools like AWK to advanced interpolation in 2020s features, such as Scala's use of backticks for literal identifiers (e.g., yield to reference keywords as names), enhancing flexibility in operator overloading without altering string delimiters.
Delimiting in Markup Languages
In markup languages, the backtick serves primarily as a delimiter for denoting literal text, such as inline code or verbatim content, without executing or interpreting it as markup. This usage emphasizes non-executable formatting for documentation and display purposes, distinguishing it from roles in programming syntax. Introduced in John Gruber's original Markdown specification in 2004, the single backtick delimits inline code spans to display short snippets of literal text, such asprint("Hello"), rendering them in a monospaced font without processing as hyperlinks or emphasis. Fenced code blocks, using triple backticks (```), were later standardized in extensions like CommonMark and enable multi-line literal blocks, for example:
This format preserves indentation and line breaks exactly as written. GitHub Flavored Markdown, an extension of the original syntax, further supports syntax highlighting by specifying a language identifier after the opening fence, such as ```python, which applies color-coded rendering to the enclosed code while keeping it non-executable.[41][42][43] In LaTeX, the backtick functions as a possible delimiter for the \verb command, which inserts verbatim text inline by treating content between matching delimiters as literal characters immune to typesetting rules. For instance, \verb|def hello(): print("world")def hello(): print("world")
example code| outputs example code exactly, including spaces and special symbols, with the backtick serving as the chosen delimiter (any non-alphanumeric character can be used, but backticks are common for code-like content). This approach evolved from early LaTeX tools for including unprocessed snippets in technical documents. The verbatim environment extends this to blocks, though it does not use backticks directly.[44]
While the backtick has no reserved or formal delimiting role in core HTML5 or XML standards—where it appears as a literal character without requiring escape in content or attributes unless embedded in scripts or conflicting with quote styles—its use for escaping remains rare and context-specific. In attribute values, backticks can occasionally delimit strings to avoid quote conflicts in non-standard parsers, but double or single quotes are recommended per the specification; for literal inclusion, it is encoded as ` if needed in dynamic contexts. Documentation tools like Doxygen integrate Markdown support, employing backticks for inline code (e.g., function) and fenced blocks with optional highlighting, enhancing code display in generated APIs without execution.-state)[45]
The backtick's adoption in templating and wiki markup evolved from early plain-text systems, where it provided a lightweight alternative to HTML tags for code-like text. In MediaWiki, native wikitext relies on tags, but extensions like BacktickCode (introduced around 2010) enable shorthand delimiting with single backticks, such as code, automatically wrapping content in semantic elements for inline literals. This mirrors broader trends in 2000s documentation tools, prioritizing readable source over complex syntax, though formal standards like HTML5 do not mandate or define backtick delimiting.[46][45]
,[object Object],
,[object Object],
,[object Object],
,[object Object],
,[object Object],
,[object Object],
,[object Object],
,[object Object],
,[object Object],
,[object Object],
,[object Object],
,[object Object]
,[object Object],
,[object Object],
,[object Object],
,[object Object],
,[object Object],
,[object Object],
,[object Object],
,[object Object],
,[object Object],
,[object Object],
,[object Object],
,[object Object]