Tilde (~): The Key, What It Means, and the Mark Over ñ

A tilde is the wavy line ~, often called the squiggly line. On a US keyboard you type it with Shift and the backtick key, left of 1. Over a letter the same shape is a mark: ñ in Spanish, a nasal ã or õ in Portuguese. Unicode keeps them apart, U+007E and U+0303. Tap a letter to copy it.

Which letters carry the tilde?

AccentPad's catalogue has 18 small letters with a tilde and 18 capitals: every catalogue letter whose Unicode decomposition includes the tilde (the catalogue takes letters on a to z, so a tilde on another base, such as ǯ, is not here). The 13 lit ones are in at least one alphabet in the Unicode CLDR; no CLDR alphabet lists the others. Tap a letter to copy it.

ã, ñ, õ, ṽ and ỹ have their own pages with every shortcut; the list below links them.

  • Ã ãa with tilde; in 6 CLDR alphabets; shortcuts and facts on the A with accent (á à â ä ã å ā) page
  • Ẫ ẫa with circumflex and tilde; in 1 CLDR alphabet; Word code 1eab
  • Ẵ ẵa with breve and tilde; in 1 CLDR alphabet; Word code 1eb5
  • Ẽ ẽe with tilde; in 4 CLDR alphabets; Word code 1ebd
  • Ễ ễe with circumflex and tilde; in 1 CLDR alphabet; Word code 1ec5
  • Ĩ ĩi with tilde; in 4 CLDR alphabets; Word code 0129
  • Ñ ñn with tilde; in 11 CLDR alphabets; shortcuts and facts on the N with tilde page
  • Õ õo with tilde; in 5 CLDR alphabets; shortcuts and facts on the O with accent (ó ò ô õ ō) page
  • Ȭ ȭo with tilde and macron; in no CLDR alphabet; Word code 022d
  • Ṍ ṍo with tilde and acute; in no CLDR alphabet; Word code 1e4d
  • Ṏ ṏo with tilde and diaeresis; in no CLDR alphabet; Word code 1e4f
  • Ỗ ỗo with circumflex and tilde; in 1 CLDR alphabet; Word code 1ed7
  • Ỡ ỡo with horn and tilde; in 1 CLDR alphabet; Word code 1ee1
  • Ũ ũu with tilde; in 4 CLDR alphabets; Word code 0169
  • Ṹ ṹu with tilde and acute; in no CLDR alphabet; Word code 1e79
  • Ữ ữu with horn and tilde; in 1 CLDR alphabet; Word code 1eef
  • Ṽ ṽv with tilde; in no CLDR alphabet; Word code 1e7d; shortcuts and facts on the V with accent (ṿ ṽ) page
  • Ỹ ỹy with tilde; in 2 CLDR alphabets; Word code 1ef9; shortcuts and facts on the Y with accent (ý ÿ ŷ ỳ ỹ) page

How do you type a tilde on each device?

  • Mac: Option+N, then the letter, documented for ã ñ õ only.
  • Microsoft Word: Ctrl+Shift+~, then the letter, documented for ã ñ õ only.
  • Chromebook: Shift+`, then the letter, documented for ã ñ õ only.

Each row is one way a vendor documents to type some of the small letters with the tilde, with the steps for the first of them; the others in the row are typed the same way. The copy keys above hold every capital. In Microsoft Word the code differs for each letter: the list above prints it. The help pages are linked at the end.

Device or appWhich lettersMethod
Mac How to type accents on a MacẽFor ẽ: Press and hold E, then choose ẽ.
ã ñ õFor ã: Option+N, then A.
every other letterFor ẫ: Fn/Globe+E, then search "latin small letter a with circumflex and tilde", then ẫ.
Windows How to type accents on Windowsã 0227, ñ 0241, õ 0245For ã: Alt+0227.
every other letterFor ẫ: Win+., then Symbols, then ẫ.
Microsoft Word How to type accents in Wordã ñ õFor ã: Ctrl+Shift+~, then A.
every other letterFor ẫ: 1eab, then Alt+X.
Google Docs How to type accents in Google Docsevery letter hereFor ã: Insert, then Symbols, then Special characters, then search "latin small letter a with tilde".
iPhone, iPadã ñ õFor ã: Touch and hold A, then slide to ã.
the other 15 lettersNo documented method.
Androidã ñ õFor ã: Touch and hold A, then slide to ã.
the other 15 lettersNo documented method.
Chromebook How to type accents on a Chromebookã ñ õFor ã: Switch to the US International keyboard, then Shift+`, then A.
the other 15 lettersNo documented method.

Sources:Mac, Mac (Apple) (opens in a new tab)Microsoft Word, Microsoft Word (Microsoft) (opens in a new tab)Chromebook, Chromebook (Google) (opens in a new tab)Windows, Microsoft Word (Microsoft) (opens in a new tab)Google Docs (Google) (opens in a new tab)iPhone, iPad (Apple) (opens in a new tab)Android (Google) (opens in a new tab)Mac (Apple) (opens in a new tab)Windows (Microsoft) (opens in a new tab)

Which English words keep ã, ẫ, ẵ, ẽ, ễ, ĩ, ñ, õ, ỗ, ỡ, ũ, ữ or ỹ?

Wiktionary lists these English words spelled with each letter, most common first by how often they appear in English subtitles:

ñ
  • señor
  • señora
  • señorita
  • piñata
  • piña
  • mañana
  • quinceañera
  • jalapeño
  • señores

Wiktionary lists no English word with ã, ẫ, ẵ, ẽ, ễ, ĩ, õ, ỗ, ỡ, ũ, ữ and ỹ that English subtitles use.

What is a tilde, and what does the ~ symbol mean?

A tilde is the small wavy line ~. It is a character of its own on every computer keyboard, and it is also the name of a mark written over letters such as ñ. Most people who look up the word mean the first one, the tilde symbol. Unicode files it as U+007E TILDE, a spacing character that stands between other characters instead of sitting on one.

Chapter 6 of the Unicode Standard (opens in a new tab) names its common jobs: alternation, an approximate value and, in some notations, logical negation. Dictionaries also use it to repeat the headword in their examples.

So a tilde meaning depends on where it stands. For most of those jobs the standard points to a more precise character, and the keyboard tilde is the stand-in that everyone can type. The table pairs each meaning with that character. The two shell rows come from POSIX (opens in a new tab), the standard behind Unix shells, and the range row from Wiktionary (opens in a new tab).

Where you see ~What it meansThe character Unicode points toSource
in front of a numberabout, roughly∼ U+223C TILDE OPERATOR, in a formulaUnicode ch. 6, Wiktionary
a ~ b in mathematicsa is similar to b, or varies with b∼ U+223C TILDE OPERATORUnicode ch. 6, NamesList
~p in logicnot p¬ U+00AC NOT SIGNUnicode ch. 6
in a dictionary examplethe headword, repeated⁓ U+2053 SWUNG DASHUnicode ch. 6, Oxford
between two numbers, in East Asian texta range, from one to the other〜 U+301C WAVE DASHWiktionary, Unicode ch. 6
alone at the start of a shell pathyour home directorynone: the shell reads only ~POSIX 2.6.1
followed by a user name, as in ~rootthat user's home directorynonePOSIX 2.6.1

The name came to the symbol late. Wiktionary's historical note (opens in a new tab) says dictionaries before ASCII, such as the Oxford English Dictionary of 1933, give tilde only as the accent.

The 1967 ASCII standard drew the character as a floating accent, to be printed over a letter on a paper terminal. Users took it over as a symbol, fonts changed to match, and the accent's name went with it. Unicode still allows both looks: modern fonts set ~ on the center line, while older terminal and typewriter fonts raise it like an accent.

Where is the tilde key on a US or UK keyboard?

On a US keyboard the tilde shares a key with the backtick: the first key of the number row, left of 1. Press it alone for ` and with Shift for ~. Microsoft's US keyboard layout (opens in a new tab) shows it this way. The key it calls VK_OEM_3 types U+0060 GRAVE ACCENT unshifted and U+007E TILDE with Shift.

The tilde on keyboard layouts outside the US can move. Microsoft's United Kingdom layout (opens in a new tab) puts ~ on Shift and the key that types #. With Shift, the top-left key gives ¬, the not sign, instead. That is why a "tilde key" guide written for US keyboards fails on a UK one.

A Mac follows the US pattern. We measured Apple's U.S. and ABC layouts on 2026-10-14 with UCKeyTranslate on macOS 26.6.2: Shift with the backtick key types U+007E. As a control, Shift with the 1 key typed !, as expected. Apple's Keyboard Viewer (opens in a new tab) shows the same on screen when you hold Shift.

The US International keyboard is different again. Google's Chromebook help (opens in a new tab) lists the tilde there as a dead key, pressed with Shift and the backtick key and followed by the letter. A dead key types nothing until the next key.

KeyboardHow to type ~The same key without ShiftSource
US, WindowsShift and the backtick key, left of 1`Microsoft US layout
United Kingdom, WindowsShift and the # key#Microsoft UK layout
U.S. or ABC, MacShift and the backtick key`measured, UCKeyTranslate
US International PC, MacShift and the backtick key, then Spacestarts a dead key: then n gives ñmeasured, UCKeyTranslate
US International, ChromebookShift and the backtick key, then the letterstarts the same dead keyGoogle Chromebook help

Why does a Mac's tilde dead key type ˜ and not ~?

Because Option+N is made for the accent, not for the symbol. Apple's page on accent marks (opens in a new tab) says so: press Option+N to enter a tilde, ˜, and then the letter, as in ã. We tested what happens when the next key is Space instead of a letter, with UCKeyTranslate on macOS 26.6.2 on 2026-10-14. On the U.S. and ABC layouts the result was U+02DC SMALL TILDE, not U+007E.

Chapter 7 of the Unicode Standard (opens in a new tab) explains why two characters exist. The old ISO 8859-1 code page left ~ unclear: an accent, or a separate symbol? Unicode uses U+007E only as a spacing character, usually drawn on the center line. It gives the raised accent standing alone a code of its own, U+02DC.

The two look alike in many fonts, and software does not treat them alike. We typed both into the shells of the same Mac on 2026-10-14:

Typed/bin/bash 3.2.57/bin/zsh 5.9
~/xthe home folder, then /xthe home folder, then /x
˜/x˜/x, unchanged˜/x, unchanged
~root/var/root/var/root

That is the POSIX rule at work. Only a real tilde at the start of a word becomes a home directory, so a path copied from a document that holds ˜ points nowhere. For a path, a web address or code, type Shift and the backtick key. Keep Option+N for ñ, ã and õ.

Is the ~ on the keyboard the same character as the tilde over ñ?

No. The keyboard gives U+007E, a character that takes up its own space. The tilde in ñ is U+0303 COMBINING TILDE: a mark with no width of its own, which sits on the letter before it. Unicode's names list (opens in a new tab) breaks ñ down into n and U+0303, and ã and õ into a and o with the same mark. Typing n and then the keyboard tilde gives two characters, never ñ.

We checked what normalization does to each form, with Node.js 26.0.0 (ICU 78.3, Unicode 17.0) on 2026-10-14. NFC joins a letter and its mark; NFKC also folds lookalike forms into their plain character.

Characters you haveAfter NFCAfter NFKC
n, then U+0303ñ, one character, U+00F1ñ
n, then ~still n and ~still n and ~
˜ U+02DCunchangeda space and U+0303
~ U+FF5Eunchanged~ U+007E

Several more characters share the shape. The names list and chapters 6 and 7 keep them apart:

CharacterCode pointWhat it is for
~U+007E TILDEthe keyboard character: paths, plain text, a rough number
◌̃U+0303 COMBINING TILDEthe mark over a letter; IPA nasalization and a Vietnamese tone mark
˜U+02DC SMALL TILDEthe accent standing alone, raised
∼U+223C TILDE OPERATORmathematics: similar to, varies with
⁓U+2053 SWUNG DASHdictionaries, and alternation
〜U+301C WAVE DASHthe JIS wave dash; for most purposes a duplicate of U+FF5E
~U+FF5E FULLWIDTH TILDEthe wide form; NFKC turns it into ~
◌̰U+0330 COMBINING TILDE BELOWIPA creaky voice
◌̴U+0334 COMBINING TILDE OVERLAYIPA velarization or pharyngealization
◌͂U+0342 COMBINING GREEK PERISPOMENIa Greek accent that may be drawn like a tilde, encoded apart from U+0303

The trap runs both ways. A raised ˜ pasted after a vowel does not make ã: in the same test, a followed by U+02DC stayed a and ˜ under NFC, and NFKC turned it into a, a space and U+0303, still not ã. A combining U+0303 typed alone has nothing to sit on.

What does a tilde over a letter do, and where did the mark come from?

A tilde over a letter tells you how to say that letter, and what it says depends on the language. Oxford (opens in a new tab) defines the tilde as the mark placed over letters in some languages, and over some IPA vowels, to show how they are pronounced. Its examples are España, São Paulo and /pɒ̃ʃɒ̃/ for penchant. The usage map above shows who writes which letter. This table says what the mark does in each place:

WhereLettersWhat the tilde doesSource
Spanishñmakes a letter of its own, the eñeWiktionary
Portugueseã õmarks a nasal vowel, as in anão and limõesPriberam, Wiktionary
Estonianõspells a vowel of its own, /ɤ/, with no nasal soundWiktionary
Vietnameseã ẽ ĩ õ ũ ỹ, and ẫ ẵ ễ ỗ ỡ ữcarries the tone called ngãUnicode ch. 7, Wiktionary
IPAany vowelmarks nasalizationNamesList, Oxford
Early Modern Englishã õstands for a following n or m: commãd, cõposeWiktionary

The Portuguese row is from Priberam (opens in a new tab), which defines til as the sign that marks nasality. The Estonian vowel and the old English spellings come from Wiktionary's entries for õ (opens in a new tab) and ã (opens in a new tab). Each letter has a fuller page: n with tilde on why Spanish counts ñ as a letter, a with accent on Portuguese ã against á, o with accent on õ, and the Vietnamese alphabet on ngã among the other tone marks.

The word itself is Spanish. Oxford dates it in English to the mid 19th century and traces it to Latin titulus, an inscription or title. Wiktionary (opens in a new tab) makes tilde a doublet of title and tittle, all from that Latin word.

Spanish still uses tilde more widely than English does. FundéuRAE (opens in a new tab) notes that Spanish calls the written accent on á a tilde, and that the wavy line of ñ is also called the virgulilla. The Spanish alphabet page covers those accent rules.

The shape began as a scribe's shortcut. Wiktionary's entry for ñ (opens in a new tab) describes a dash over a letter as medieval shorthand for an extra m or n. Early Modern English spelling used it too: commãd for command, hãmer for hammer, reckõ for reckon. Spanish kept the shortcut in ñ, where it stood for nn, and made it a letter. In most other places the line now marks a sound, not a missing letter.

Which languages write the tilde, and on which letters?

Letters with the tilde are part of the standard alphabet of 18 languages in the Unicode CLDR, from Asturian to Wolof. Each language and the letters with the tilde its alphabet holds:

  • Asturian: ñ
  • Basque: ñ
  • Breton: ñ
  • Estonian: õ
  • Ewe: ã ẽ ĩ õ ũ
  • Filipino: ñ
  • Galician: ñ
  • Kabuverdianu: ñ
  • Kaingang: ã ẽ ĩ ũ ỹ
  • Kuvi: ñ
  • Ligurian: ñ
  • Nheengatu: ã ẽ ĩ ũ
  • Portuguese: ã õ
  • Quechua: ñ
  • Silesian: ã õ
  • Spanish: ñ
  • Vietnamese: ã ẫ ẵ ẽ ễ ĩ õ ỗ ỡ ũ ữ ỹ
  • Wolof: ñ

No CLDR alphabet lists ȭ, ṍ, ṏ, ṹ and ṽ.

How do you pronounce ã, ẫ, ẵ, ẽ, ễ, ĩ, ñ, õ, ỗ, ỡ, ũ, ữ or ỹ?

WikiPron transcribes these letters in common words from Wiktionary: in Portuguese, não is /nɐ̃w̃/; in Spanish, señor is /seɲoɾ/; in Portuguese, milhões is /miʎõj̃s/. The table gives one example word per letter and language.

LetterLanguageExampleIPA
ãPortuguesenão/nɐ̃w̃/
ñSpanishseñor/seɲoɾ/
õPortuguesemilhões/miʎõj̃s/

The WikiPron lists used here have no example word for ẫ, ẵ, ẽ, ễ, ĩ, ỗ, ỡ, ũ, ữ and ỹ.

Which common words use ã, ẫ, ẵ, ẽ, ễ, ĩ, ñ, õ, ỗ, ỡ, ũ, ữ or ỹ?

FrequencyWords counts the words used in film and TV subtitles, and its lists give these as the most frequent words with each letter in each language, most common first.

ã
Portuguese:
  • não
  • então
  • são
  • estão
  • tão
  • mãe
  • vão
  • razão
ñ
Spanish:
  • señor
  • años
  • mañana
  • cariño
  • señora
  • año
  • niños
  • niño
õ
Portuguese:
  • milhões
  • informações
  • põe
  • razões
  • impressões
  • condições
  • relações
  • operações

No list here has a common word with ẫ, ẵ, ẽ, ễ, ĩ, ỗ, ỡ, ũ, ữ and ỹ.

Which names and places are spelled with ã, ẫ, ẵ, ẽ, ễ, ĩ, ñ, õ, ỗ, ỡ, ũ, ữ or ỹ?

Given names come from Wikidata, the most widely covered first by the number of Wikipedia editions about them, and places come from the GeoNames list of cities, largest population first, kept only where an official language of the country writes the letter.

ã

Given names: João, Estêvão, Sebastião

Places:
  • São Paulo (Brazil)
  • São Luís (Brazil)
  • São Bernardo do Campo (Brazil)
  • João Pessoa (Brazil)
  • São José dos Campos (Brazil)
  • Ribeirão Preto (Brazil)
  • Jaboatão dos Guararapes (Brazil)
  • São José do Rio Preto (Brazil)
ẽ

Places: Thị Trấn Ba Chẽ (Vietnam)

ễ

Places: Cầu Diễn (Vietnam), Diễn Thành (Vietnam), Liễu Giai (Vietnam)

ĩ
Places:
  • Dĩ An (Vietnam)
  • Hà Tĩnh (Vietnam)
  • Vĩnh Châu (Vietnam)
  • Vĩnh Long (Vietnam)
  • Vĩnh Yên (Vietnam)
  • Vĩnh Thạnh (Vietnam)
  • Nghĩa Đô (Vietnam)
  • Vĩnh Tuy (Vietnam)
ñ
Given names:
  • Iñaki
  • Begoña
  • Beñat
  • Íñigo
  • Nuño
  • Ordoño
Places:
  • Las Piñas (Philippines)
  • Dasmariñas (Philippines)
  • Tapachula de Córdova y Ordóñez (Mexico)
  • Viña del Mar (Chile)
  • Biñan (Philippines)
  • Ñuñoa (Chile)
  • A Coruña (Spain)
  • Peñalolén (Chile)
õ

Given names: Tõnu, Tõnis, Õnne

Places:
  • Simões Filho (Brazil)
  • Três Corações (Brazil)
  • Giảng Võ (Vietnam)
  • Põhja-Tallinn (Estonia)
  • Poções (Brazil)
  • Nõmme (Estonia)
  • Matões (Brazil)
  • Palmeira das Missões (Brazil)
ỗ

Places: Dại Mỗ (Vietnam), Tây Mỗ (Vietnam)

ũ

Places: Vũng Tàu (Vietnam), Chũ (Vietnam)

ỹ
Places:
  • Phú Mỹ (Vietnam)
  • Mỹ Tho (Vietnam)
  • Mỹ Hào (Vietnam)
  • Long Mỹ (Vietnam)
  • Hưng Mỹ (Vietnam)
  • Xóm Mỹ Xuân (Vietnam)
  • Mỹ Lại (Vietnam)
  • Mỹ Khê (Vietnam)

Neither list has a name or place with ẫ, ẵ, ỡ and ữ.

Which languages use ã, ẫ, ẵ, ẽ, ễ, ĩ, ñ, õ, ỗ, ỡ, ũ, ữ or ỹ?

Between them, ã, ẫ, ẵ, ẽ, ễ, ĩ, ñ, õ, ỗ, ỡ, ũ, ữ and ỹ are part of the standard alphabet of 18 languages in the Unicode CLDR. Each letter's languages:

ã
6 languages:
  • Ewe
  • Kaingang
  • Nheengatu
  • Portuguese
  • Silesian
  • Vietnamese
ẫ
1 language: Vietnamese
ẵ
1 language: Vietnamese
ẽ
4 languages: Ewe, Kaingang, Nheengatu, Vietnamese
ễ
1 language: Vietnamese
ĩ
4 languages: Ewe, Kaingang, Nheengatu, Vietnamese
ñ
11 languages:
  • Asturian
  • Basque
  • Breton
  • Filipino
  • Galician
  • Kabuverdianu
  • Kuvi
  • Ligurian
  • Quechua
  • Spanish
  • Wolof
õ
5 languages: Estonian, Ewe, Portuguese, Silesian, Vietnamese
ỗ
1 language: Vietnamese
ỡ
1 language: Vietnamese
ũ
4 languages: Ewe, Kaingang, Nheengatu, Vietnamese
ữ
1 language: Vietnamese
ỹ
2 languages: Kaingang, Vietnamese

How to type the tilde and its letters, step by step

Step 1: The ~ itself: Shift and the backtick key

On a US keyboard, hold Shift and press the key left of 1, the one that types a backtick on its own. A Mac with the U.S. or ABC layout works the same way. On the US International keyboard Shift+` is a dead key: press it, then the next key.

Step 2: Mac: Option+N, then the letter

Press Option+N and let go, then press N for ñ, A for ã or O for õ. Hold Shift on the second key for Ñ, Ã or Õ.

Step 3: Windows: an Alt code on the number pad

Turn Num Lock on, hold Alt and type the code: Alt+0241 gives ñ, Alt+0227 gives ã and Alt+0245 gives õ. The capitals have their own codes in the table above.

Step 4: Microsoft Word: Ctrl+Shift+~, then the letter

Press Ctrl+Shift+~ together and release, then press N, A or O. For the Vietnamese ỹ, type 1ef9 and press Alt+X right after the code.

Step 5: Chromebook: the US International keyboard

Switch to the US International keyboard. Press Shift+` and then N to get ñ, or A or O for ã and õ.

Step 6: Mac: the Character Viewer for ĩ, ũ, ẽ and ỹ

Press Fn/Globe+E and search the letter's name, such as latin small letter i with tilde, then click ĩ. Swap the vowel in the search to find ũ, ẽ or ỹ.

What are the Alt codes for the tilde and its letters?

Hold Alt and type the digits on the number pad with Num Lock on. The top row of digits does not work, and laptops without a number pad need the methods above.

LetterAlt code
ãAlt+0227
ñAlt+0241
õAlt+0245
ÃAlt+0195
ÑAlt+0209
ÕAlt+0213

ẫ ẵ ẽ ễ ĩ ỗ ỡ ũ ữ ỹ Ẫ Ẵ Ẽ Ễ Ĩ Ỗ Ỡ Ũ Ữ Ỹ have no Alt code: Windows cannot type them that way.

Which AccentPad pages cover letters with the tilde?

These letter pages each hold one or more letters with the tilde, with every shortcut and the facts for that letter:

Whole alphabets, every letter in order, that use the tilde:

Every other mark, each with its letters to copy, is on the All diacritics page.

Need a letter without a tilde?

Frequently asked questions about the tilde and its letters

What does ~ mean in front of a number?

About, or roughly. Unicode's core specification counts an approximate value among the common uses of the tilde, and Wiktionary gives it for English prose and for mathematics. In a formula the standard asks for U+223C TILDE OPERATOR rather than the keyboard character.

What does ~ mean in a file path such as ~/Documents?

Your home folder. POSIX, the standard behind Unix shells, says a word that starts with a tilde alone is replaced by the HOME variable, and ~name by that user's home directory. On a Mac we checked bash and zsh: both turned ~root into /var/root and left a raised ˜ untouched.

How do I type a tilde on a UK keyboard?

Hold Shift and press the key that types #. Microsoft's United Kingdom layout puts the tilde there, not on the top-left key, which gives ¬, the not sign, with Shift. So a guide written for US keyboards sends UK readers to the wrong key.

Why does my Mac type ˜ instead of ~?

You used the accent key. Option+N is a dead key for ñ, ã and õ. When we ran Space after it through macOS's own key translation, on the U.S. and ABC layouts, the result was U+02DC SMALL TILDE, the raised accent. For the symbol itself, hold Shift and press the backtick key next to 1.

What else is a tilde called?

Wiktionary lists squiggle and twiddle as computer-industry names, and swung dash or wave dash for the symbol in dictionaries and in ranges. Portuguese calls the mark til. FundéuRAE notes that Spanish uses tilde mostly for the written accent on á, while the line over ñ is also called the virgulilla.

Can I write n~ instead of ñ?

Not if anyone needs to search the word. We normalized both on Node.js 26: n followed by U+0303 composes into ñ, while n followed by the keyboard tilde stays two characters under NFC and NFKC alike. A search for año will not find an~o.