The tilde ( or ; ˜ or ~) is a grapheme with several uses. The name of the character came into English from Spanish and from Portuguese, which in turn came from the Latin titulus, meaning "title" or "superscription".
The reason for the name was that it was originally written over a letter as a scribal abbreviation, as a "mark of suspension", shown as a straight line when used with capitals. Thus the commonly used words Anno Domini were frequently abbreviated to Ao Dñi, an elevated terminal with a suspension mark placed over the "n". Such a mark could denote the omission of one letter or several letters. This saved on the expense of the scribe's labour and the cost of vellum and ink. Medieval European charters written in Latin are largely made up of such abbreviated words with suspension marks and other abbreviations; only uncommon words were given in full.
The tilde has since been applied to a number of other uses as a diacritic mark or a character in its own right. These are encoded in Unicode at U+0303 ◌̃ COMBINING TILDE and U+007E ~ TILDE (as a spacing character), and there are additional similar characters for different roles. In lexicography, the latter kind of tilde and the swung dash (⁓) are used in dictionaries to indicate the omission of the entry word.
This symbol (in US English) informally means "approximately", "about", or "around", such as "~30 minutes before", meaning "approximately 30 minutes before". It can mean "similar to", including "of the same order of magnitude as", such as: "x ~ y" meaning that x and y are of the same order of magnitude. Another approximation symbol is the double-tilde ≈, meaning "approximately equal to". The tilde is also used to indicate congruence of shapes by placing it over the "=" symbol, like so: ≅. In the computing field, especially in Unix based systems, the tilde indicates the user's home directory.
The text of the Domesday Book of 1086, relating for example, to the manor of Molland in Devon (see image left), is highly abbreviated as indicated by numerous tildes. The text with abbreviations expanded is as follows:
Mollande tempore regis Edwardi geldabat pro quattuor hidis et uno ferling. Terra est quadraginta carucae. In dominio sunt tres carucae et decem servi et triginta villani et viginta bordarii cum sedecim carucis. Ibi duodecim acrae prati et quindecim acrae silvae. Pastura tres leugae in longitudine et latitudine. Libras ad pensam. Huic manerio est adjuncta Blachepole. Elwardus tenebat tempore regis Edwardi pro manerio et geldabat pro dimidia hida. Terra est duae carucae. Ibi sunt quinque villani cum uno servo. Valet viginti solidos ad pensam et arsuram. Eidem manerio est injuste adjuncta Nimete et valet quindecim solidos. Ipsi manerio pertinet tercius denarius de Hundredis Nortmoltone et Badentone et Brantone et tercium animal pasturae morarum.
The incorporation of the tilde (~) into ASCII is a direct result of its appearance as a distinct character on mechanical typewriters in the late nineteenth century. When all character sets were pieces of metal permanently installed, and number of characters much more limited than in typography, the question of which languages and markets required which characters was an important one. Any good typewriter store had a catalog of alternative keyboards that could be specified for machines ordered from the factory.
At that time, the tilde was used only in Spanish and Portuguese typewriters (keyboards). In Modern Spanish, the tilde is used only with ñ and Ñ. Both were conveniently assigned to a single mechanical typebar, which sacrificed a key that was felt to be less important, usually the 1⁄2—1⁄4 key.
Portuguese, however, uses not ñ but nh. It uses the tilde on the vowels a and o. So as not to sacrifice two of the tightly limited keys to ã Ã õ Õ, the decision was made to make the ~ a separate "dead" character in which the carriage holding the paper did not move. Dead keys, which had a notch cut out to avoid hitting a mechanical linkage that triggered carriage movement, were used for characters that were intended to be combined (overstruck).
On mechanical typewriters, Spanish keyboards (the first, or one of the first, non-English keyboards) had a dead key, which contained the acute accent (´), used over any vowel, and the dieresis (¨), used only over u. It was a simple matter to create a dead key for a Portuguese keyboard (created later than the Spanish one) to be overstruck with a and o and so the ~ was born as a typographical character, which did not exist previously as a type or hot-lead printing character. That was probably a product of the first and leading manufacturer of (mechanical) typewriters, Remington.
As indicated by the etymological origin of the word "tilde" in English, this symbol has been closely associated with the Spanish language. The connection stems from the use of the tilde above the letter "n" to form "ñ" in Spanish, a feature shared by only a few other languages, all historically connected to Spanish. This peculiarity can help non-native speakers quickly identify a text as being written in Spanish with little chance of error. In addition, most native speakers, although not all, use the word "español" to refer to their language. Particularly during the 1990s, Spanish-speaking intellectuals and news outlets demonstrated support for the language and the culture by defending this letter against globalisation and computerisation trends that threatened to remove it from keyboards and other standardised products and codes. The Instituto Cervantes, founded by Spain's government to promote the Spanish language internationally, chose as its logo a highly stylised Ñ with a large tilde. The 24-hour news channel CNN in the US later adopted a similar strategy on its existing logo for the launch of its Spanish-language version. And similarly to the National Basketball Association (NBA), the Spain men's national basketball team is nicknamed ÑBA.
Confusingly, in Spanish itself the word tilde is used more generally for diacritics, including the stress-marking acute accent. The diacritic ~ is more commonly called virgulilla or la tilde de la eñe, and is not considered an accent mark in Spanish, but rather simply a part of the letter ñ (much like the dot over the i).
Later, it was used to make abbreviations in medieval Latin documents. When an ⟨n⟩ or ⟨m⟩ followed a vowel, it was often omitted, and a tilde (i.e., a small ⟨n⟩) was placed over the preceding vowel to indicate the missing letter; this is the origin of the use of tilde to indicate nasalization (compare the development of the umlaut as an abbreviation of ⟨e⟩.) The practice of using the tilde over a vowel to indicate omission of an ⟨n⟩ or ⟨m⟩ continued in printed books in French as a means of reducing text length until the 17th century. It was also used in Portuguese, and Spanish.
The tilde was also used occasionally to make other abbreviations, such as over the letter ⟨q⟩ ("q̃") to signify the word que ("that").
It is also as a small ⟨n⟩ that the tilde originated when written above other letters, marking a Latin ⟨n⟩ which had been elided in old Galician-Portuguese. In modern Portuguese it indicates nasalization of the base vowel: mão "hand", from Lat. manu-; razões "reasons", from Lat. rationes. This usage has been adopted in the orthographies of several native languages of South America, such as Guarani and Nheengatu, as well as in the International Phonetic Alphabet (IPA) and many other phonetic alphabets. For example, [ljɔ̃] is the IPA transcription of the pronunciation of the French place-name Lyon.
In Breton, the symbol ⟨ñ⟩ after a vowel means that the letter ⟨n⟩ serves only to give the vowel a nasalised pronunciation, without being itself pronounced, as it normally is. For example, ⟨an⟩ gives the pronunciation [ãn] whereas ⟨añ⟩ gives [ã].
The tilded ⟨n⟩ (⟨ñ⟩, ⟨Ñ⟩) developed from the digraph ⟨nn⟩ in Spanish. In this language, ⟨ñ⟩ is considered a separate letter called eñe (IPA: [ˈeɲe]), rather than a letter-diacritic combination; it is placed in Spanish dictionaries between the letters ⟨n⟩ and ⟨o⟩. In Spanish the word tilde actually refers to diacritics in general, e.g. the acute accent in José, while the diacritic in ⟨ñ⟩ is called "virgulilla" (IPA: [birɣuˈliʝa]). Current languages in which the tilded ⟨n⟩ (⟨ñ⟩) is used for the palatal nasal consonant /ɲ/ include:
There are many Unicode characters for tildes, symbols incorporating tildes, and characters visually similar to a tilde:
Most modern proportional fonts align the plain ASCII spacing tilde at the same level as dashes, or only slightly upper. This distinguishes it from the small tilde ( ˜ ) introduced with Windows-1252, which is always raised. But in some monospace fonts, especially used in text user interfaces, ASCII tilde character is raised too. This apparently is a legacy of typewriters, where pairs of similar spacing and combining characters relied on one glyph. Even in line printers' age character repertoires were often not large enough to distinguish between plain tilde, small tilde and combining tilde. Overprinting of a letter by the tilde was a working method of combining a letter.
In some languages (though not generally in English), a tilde-like wavy dash may be used as punctuation (instead of an unspaced hyphen, en dash or em dash) between two numbers, to indicate a range rather than subtraction or a hyphenated number (such as a part number or model number). For example, "12~15" means "12 to 15", "~3" means "up to three", and "100~" means "100 and greater". Japanese and other East Asian languages almost always use this convention, but it is often done for clarity in some other languages as well. Chinese uses the wavy dash and full-width em dash interchangeably for this purpose. In English, the tilde is often used to express ranges and model numbers in electronics, but rarely in formal grammar or in type-set documents, as a wavy dash preceding a number sometimes represents an approximation (see below).
Before a number the tilde can mean "approximately"; "~42" means "approximately 42". When used with currency symbols, the tilde precedes the dollar or pound or euro sign, thus "~$10" for about ten dollars.
The wave dash (波ダッシュ, nami dasshu) is used for various purposes in Japanese, including to denote ranges of numbers, in place of dashes or brackets, and to indicate origin. The wave dash is also used to separate a title and a subtitle in the same line, as a colon is used in English.
When used in conversations via email or instant messenger it may be used as a sarcasm mark.
The sign is used as a replacement for the chouon, katakana character, in Japanese, extending the final syllable.
In practice the full-width tilde (全角チルダ, zenkaku chiruda), Unicode U+FF5E, is often used instead of the wave dash (波ダッシュ, nami dasshu), Unicode U+301C, because the Shift JIS code for the wave dash, 0x8160, which is supposed to be mapped to U+301C, is instead mapped to U+FF5E in Windows code page 932 (Microsoft's code page for Japanese), a widely used extension of Shift JIS.
This avoided a shape definition error in the Unicode code charts: the wave dash reference glyph in JIS / Shift JIS matches the Unicode reference glyph for U+FF5E, while the reference glyph for U+301C was reflected, incorrectly, when Unicode imported the JIS wave dash. In other platforms such as the classic Mac OS and macOS, 0x8160 is correctly mapped to U+301C. It is generally difficult, if not impossible, for users of Japanese Windows to type U+301C, especially in legacy, non-Unicode applications.
A similar situation exists regarding the Korean KS X 1001 character set, in which Microsoft maps the EUC-KR or UHC code for the wave dash (0xA1AD) to U+223C (Tilde Operator), while IBM and Apple map it to U+301C.
The current Unicode reference glyph for U+301C has been corrected to match the JIS standard in response to a 2014 proposal, which noted that while the existing Unicode reference glyph had been matched by fonts from the discontinued Windows XP, all other major platforms including later versions of Microsoft Windows matched the JIS reference glyph for U+301C.
The JIS / Shift JIS wave dash is still formally mapped to U+301C as of JIS X 0213, whereas the WHATWG Encoding Standard used by HTML5 follows Microsoft in mapping 0x8160 to U+FF5E. These two code points have a similar or identical glyph in several fonts, reducing the confusion and incompatibility.
A tilde in front of a single quantity can mean "approximately", "about" or "of the same order of magnitude as."
In written mathematical logic, the tilde represents negation: "~p" means "not p", where "p" is a proposition. Modern use often replaces the tilde with the negation symbol (¬) for this purpose, to avoid confusion with equivalence relations.
In mathematics, the tilde operator (Unicode U+223C), sometimes called "twiddle", is often used to denote an equivalence relation between two objects. Thus "x ~ y" means "x is equivalent to y". It is a weaker statement than stating that x equals y. The expression "x ~ y" is sometimes read aloud as "x twiddles y", perhaps as an analogue to the verbal expression of "x = y".
A tilde is also used to indicate "approximately equal to" (e.g. 1.902 ~= 2). This usage probably developed as a typed alternative to the libra symbol used for the same purpose in written mathematics, which is an equal sign with the upper bar replaced by a bar with an upward hump, bump, or loop in the middle (︍︍♎︎) or, sometimes, a tilde (≃). The symbol "≈" is also used for this purpose.
A tilde can also be used to represent geometric similarity (e.g. ∆ABC ~ ∆DEF, meaning triangle ABC is similar to DEF). A triple tilde (≋) is often used to show congruence, an equivalence relation in geometry.
For relations involving preference, economists sometimes use the tilde to represent indifference between two or more bundles of goods. For example, to say that a consumer is indifferent between bundles x and y, an economist would write x ~ y.
On Unix-like operating systems (including AIX, BSD, Linux and macOS), tilde normally indicates the current user's home directory. For example, if the current user's home directory is /home/user, then the command cd ~ is equivalent to cd /home/user, cd $HOME, or cd. This convention derives from the Lear-Siegler ADM-3A terminal in common use during the 1970s, which happened to have the tilde symbol and the word "Home" (for moving the cursor to the upper left) on the same key. When prepended to a particular username, the tilde indicates that user's home directory (e.g., ~janedoe for the home directory of user janedoe, such as /home/janedoe).
Used in URLs on the World Wide Web, it often denotes a personal website on a Unix-based server. For example, http://www.example.com/~johndoe/ might be the personal web site of John Doe. This mimics the Unix shell usage of the tilde. However, when accessed from the web, file access is usually directed to a subdirectory in the user's home directory, such as /home/username/public_html or /home/username/www.
In URLs, the characters %7E (or %7e) may substitute for tilde if an input device lacks a tilde key. Thus, http://www.example.com/~johndoe/ and http://www.example.com/%7Ejohndoe/ will behave in the same manner.
A variant of this, with the plain tilde replaced with
=~, was adopted in Perl, and this semi-standardization has led to the use of these operators in other programming languages, such as Ruby or the SQL variant of the database PostgreSQL.
In the C, C++ and C# programming languages, the tilde character is used as bitwise NOT operator, following the notation in logic (an
! causes a logical NOT, instead). In C++ and C#, the tilde is also used as the first character in a class's method name (where the rest of the name must be the same name as the class) to indicate a destructor – a special method which is called at the end of the object's life. The MySQL database also use tilde as bitwise invert.
In ASP.NET application tilde ('~') is used as a shortcut to the root of the application's virtual directory.
In the CSS stylesheet language, the tilde is used for the indirect adjacent combinator as part of a selector.
In the D programming language, the tilde is used as an array concatenation operator, as well as to indicate an object destructor and bitwise not operator. Tilde operator can be overloaded for user types, and binary tilde operator is mostly used to merging two objects, or adding some objects to set of objects. It was introduced because plus operator can have different meaning in many situations. For example, what to do with "120" + "14" ? Is this a string "134" (addition of two numbers), or "12014" (concatenation of strings) or something else? D disallows + operator for arrays (and strings), and provides separate operator for concatenation (similarly PHP programming language solved this problem by using dot operator for concatenation, and + for number addition, which will also work on strings containing numbers).
In Eiffel, the tilde is used for object comparison. If a and b denote objects, the boolean expression a ~ b has value true if and only if these objects are equal, as defined by the applicable version of the library routine is_equal, which by default denotes field-by-field object equality but can be redefined in any class to support a specific notion of equality. If a and b are references, the object equality expression a ~ b is to be contrasted with a = b which denotes reference equality. Unlike the call a.is_equal (b), the expression a ~ b is type-safe even in the presence of covariance.
In the Inform programming language, the tilde is used to indicate a quotation mark inside a quoted string.
In Common Lisp, the tilde is used as the prefix for format specifiers in format strings. In Max/MSP, a tilde is used to denote objects that process at the computer's sampling rate, i.e. mainly those that deal with sound.
In Standard ML, the tilde is used as the prefix for negative numbers and as the unary negation operator.
In OCaml, the tilde is used to specify the label for a labeled parameter.
~~number as a short syntax for a cast to integer (numbers are stripped of their decimal part and changed into their complement, and then back. The net result is thus only the removal of the decimal part). For positive numbers, this is equivalent to the mathematical floor function.
In Object REXX, the twiddle is used as a "message send" symbol. For example,
Employee.name~lower() would cause the
lower() method to act on the object
name attribute, returning the result of the operation.
~~ returns the object that received the method rather than the result produced. Thus it can be used when the result need not be returned or when cascading methods are to be used.
team~~insert("Jane")~~insert("Joe")~~insert("Steve") would send multiple concurrent
insert messages, thus invoking the
insert method three consecutive times on the
The dominant Unix convention for naming backup copies of files is appending a tilde to the original file name. It originated with the Emacs text editor and was adopted by many other editors and some command-line tools.
Emacs also introduced an elaborate numbered backup scheme, with files named filename.~1~, filename.~2~ and so on. It didn't catch on, as the rise of version control software eliminates the need for this usage.
The tilde was part of Microsoft's filename mangling scheme when it extended the FAT file system standard to support long filenames for Microsoft Windows. Programs written prior to this development could only access filenames in the so-called 8.3 format—the filenames consisted of a maximum of eight characters from a restricted character set (e.g. no spaces), followed by a period, followed by three more characters. In order to permit these legacy programs to access files in the FAT file system, each file had to be given two names—one long, more descriptive one, and one that conformed to the 8.3 format. This was accomplished with a name-mangling scheme in which the first six characters of the filename are followed by a tilde and a digit. For example, "Program Files" might become "PROGRA~1".
The tilde symbol is also often used to prefix hidden temporary files that are created when a document is opened in Windows. For example, when a document "Document1.doc" is opened in Word, a file called "~$cument1.doc" is created in the same directory. This file contains information about which user has the file open, to prevent multiple users from attempting to change a document at the same time.
Computer programmers use the tilde in various ways and sometimes call the symbol (as opposed to the diacritic) a squiggle, squiggly, or twiddle. According to the Jargon File, other synonyms sometimes used in programming include not, approx, wiggle, enyay (after eñe) and (humorously) sqiggle . It is used in many languages as a binary inversion operator, swapping a number's binary 1's and 0's for example ~10 (binary ~1010) is equal to 5 (binary 0101).
In the juggling notation system Beatmap, tilde can be added to either "hand" in a pair of fields to say "cross the arms with this hand on top". Mills Mess is thus represented as (~2x,1)(1,2x)(2x,~1)*.
Where a tilde is on the keyboard depends on the computer's language settings according to the following chart. On many keyboards it is primarily available through a dead key that makes it possible to produce a variety of precomposed characters with the diacritic. In that case, a single tilde can typically be inserted with the dead key followed by the space bar, or alternatively by striking the dead key twice in a row.
To insert a tilde with the dead key, it is often necessary to simultaneously hold down the Alt Gr key. On the keyboard layouts that include an Alt Gr key, it typically takes the place of the right-hand Alt key. With a Macintosh either of the Alt/Option keys function similarly.