Back
Asciify Logo
Asciify
}DEL

Tilde

~ (Tilde) is ASCII code point 126 (0x7E), Unicode U+007E, and a printable punctuation character. It's a small wave hovering above the baseline — in Spanish and Portuguese it nasalizes vowels and transforms the letter n into ñ, but in ASCII it stands alone, a diacritical mark with no letter beneath it. Unix shells gave the tilde its most iconic computing role: ~ expands to the current user's home directory, so cd ~ takes you home and ~/Documents is an absolute path in disguise. C and C-family languages use it as the bitwise NOT operator, flipping every bit in a value — ~0 yields all ones, which in two's complement representation equals -1. Python adopted the same convention. In destructors, C++ prefixes the class name with ~ (~Widget()), marking the method that tears down what the constructor built. Regular expressions in some flavors use =~ as the match operator. The trap is a numerical one: applying ~ to unsigned integers produces values that depend entirely on the width of the type, so ~0 as a uint8_t is 255, as a uint16_t is 65535, and assigning the result to a narrower type without a cast silently truncates it — a bug that unit tests with small values won't catch. The tilde entered ASCII as a standalone version of the combining diacritical mark, inheriting its shape from medieval scribal abbreviations where a small n written above a letter indicated a following nasal consonant. UTF-8 encodes it as a single byte 0x7E. Unicode classifies it as Sm (Symbol, Math) with the name TILDE. The combining tilde (U+0303) is the version that actually sits above a letter, and the fullwidth ~ (U+FF5E) common in CJK text is a wider glyph frequently encountered in Japanese URLs, where it causes encoding headaches because some legacy Japanese encodings mapped it to a different code point entirely.

Symbol

Technical Details

Code Example

</>
unsigned mask = 0x0F;
unsigned cleared = x & ~mask; // clear low 4 bits
int is_power2 = (n > 0) && ((n & (n - 1)) == 0); // bit trick

Frequently Asked Questions

  • ~ expands to your home directory in Unix shells: ~/Documents means /home/username/Documents. ~user expands to another user's home. This expansion is done by the shell, not the OS — so it works in Bash commands but not in most programming languages without explicit expansion.

  • In npm (Node.js), ~1.2.3 means 'compatible with patch releases' — it allows 1.2.x but not 1.3.0. This is more conservative than ^1.2.3 (which allows 1.x.x). In Composer (PHP), ~ has similar meaning. The tilde gives you bug fixes without risking breaking changes from minor version bumps.

  • ~ flips every bit of a number: ~5 (binary 0101) becomes -6 (binary ...1010 in two's complement). The result is always -(n+1). A clever trick: ~~value truncates a float to an integer (faster than Math.floor but less readable). ~-1 equals 0, which is why ~array.indexOf(x) was used as a truthy check.

  • Tilde has no special meaning in standard regex — it matches a literal ~. However, some tools use it as a regex operator: in Perl, =~ applies a regex (if $str =~ /pattern/). In Apache configs, ~ flags a regex match in location directives. These are tool-specific, not part of the regex language itself.

@workani&@alexluthor
Privacy & legal

Privacy

No accounts, no ads, no tracking cookies, and no cross-site tracking. The only analytics we keep are faceless — anonymous, aggregated counts of pages and searches, never tied to you. We store no IP addresses, set no tracking cookies, and build no profiles. Cloudflare hosts the site and handles requests for delivery and security.

Full privacy policy·Extension privacy·legal@asciify.dev

Attributions & licenses

Twemoji
© Twitter, Inc and other contributors · CC-BY 4.0
Noto Color Emoji
© Google · Apache 2.0
Fluent UI Emoji
© Microsoft · MIT
OpenMoji
© HfG Schwäbisch Gmünd · CC-BY-SA 4.0
Toss Face
© Viva Republica (Toss) · SIL OFL 1.1
JoyPixels
© JoyPixels Inc. · Free Limited Use License
SerenityOS Emoji
© The SerenityOS Developers · BSD-2-Clause
EmojiTwo
© EmojiTwo contributors · CC-BY 4.0
Apple Color Emoji
© Apple, Inc.
Facebook Emoji
© Meta Platforms, Inc.

Apple and Facebook emoji styles are proprietary and shown here solely for reference and comparison — a common-sense application of nominative-use / fair-use principles. asciify is not affiliated with, endorsed by, or sponsored by Apple, Inc., Meta Platforms, Inc., or any other rights holder listed above. If a rights holder requests removal of their emoji style from this site, it will be removed.

All other vendor emoji are reproduced for reference and comparison under their respective open licenses listed above.

Character names and code points from the Unicode® Standard. Unicode® and the Unicode Logo are registered trademarks of Unicode, Inc.

Privacy
© asciify.dev 2025-2026