What this tool does
Caverphone is a phonetic matching algorithm created by David Hood at the University of Otago for the Caversham project, which linked New Zealand electoral and census records full of inconsistent spellings. This encoder implements Caverphone 2.0, the 2004 revision, producing a fixed 10-character code in your browser. It is especially good at matching New Zealand, Australian and English surnames.
How it works
Caverphone 2.0 is defined as a strict sequence of string substitutions applied in a fixed order — the order itself is part of the specification. It begins by removing a trailing E and rewriting special openings:
^cough -> cou2f ^gn -> 2n mb$ -> m2
ce -> se ci -> si tch -> 2ch
c/q/x -> k v -> f ph -> fh
b -> p sh -> s2 z -> s
After the consonants are normalised, vowels are coded (a leading vowel becomes A, others become 3), then runs of identical consonant letters are collapsed (S+, T+, P+, K+ and so on). Finally the placeholder digits 2 and 3 are stripped, the result is right-padded with the digit 1, and it is truncated to exactly ten characters.
Example and notes
Reference values match the widely used implementations: “Stevenson” gives STFNSN1111, “Thompson” gives TMPSN11111, “Peter” gives PTA1111111 and “Caverphone” itself gives KFFN111111. Because every code is the same fixed width, you can store Caverphone keys in a database column and compare them with a simple equality test. Use it as a candidate-generation step for genealogy, electoral-roll or historical-record matching, then confirm with closer comparison. All encoding happens locally — no data is sent anywhere.