The tilde indicated that the g is supposed to be a nasal sound. The letter represented the velar nasal/ŋ/ when the Spanish-based orthography was used. In the newer orthographies, the digraphng (treated as a letter in the newer alphabets) represented the sound.
The letter usually written an⟨n⟩ before it, For example:bang̃o (bango,“fragrance”). However, the letter can also stand by itself as inbag̃o.
Without the tilde, the⟨ng⟩ will be understood as/ŋɡ/ in the Spanish-based orthography and can be interpreted differently. For example, the difference betweenmang̃a (manga /mga,“plural marker”) andmanga (mangga,“mango”). Although, in rare instances,⟨g̃g⟩ can be found written together for/ŋɡ/ as in:mag̃ga.
If the⟨ng̃⟩ does not follow a vowel, it can already be understood as the nasal sound. For example,binasang̃ aclat can simply be written asbinasang aclat (binasangaklat,“read book”). However, one should still write it asbinasag̃ aclat so that it does not get interpreted asbinasag aclat (“fractured, book”).
Since a tilde above vowels (or⟨m⟩ and⟨n⟩, ex.anno →año) in old Spanish orthographies represented an implicit letter with a nasal sound (⟨m⟩,⟨n⟩,⟨g̃⟩) after the said vowel, parang can also be written as parãg or parã.
Besides⟨g⟩, the velar nasal/ŋ/ is already implied when⟨n⟩ is before the letter⟨c⟩, and⟨g̃⟩ does not need to be written in the Spanish-based orthography. For example:banca (bangka,“boat”).
Sometimes,⟨ng̃⟩ is being written as⟨ñg⟩ or⟨g̃n⟩ but still understood as the velar nasal sound.
The letter is calledgangosa(“nasal; nosy”) in old Tagalog texts.