The guide
Soundex files a name by its sound, and two honest rules disagree on 2001 strings
A four-character code once let clerks find a surname under any spelling. How the code is made, where the census rule and the simplified rule part, and why a match is only a hint.
- A261 Ashcraft under the census rule; the simplified rule gives A226
- 2001 of 28561 four-letter strings that the two rules code differently
- R163 the code shared by Robert and Rupert
- 1918 year the first patent for the method was granted
Read the full guide Fold the guide
A census taker hears a surname once and writes it as best they can. Years later a clerk, or a descendant, has to find that family without knowing which spelling was used. Soundex was built for that problem. It does not ask how a name is spelled. It asks roughly how it sounds, and it files names that sound alike in one place.
What the code was built for
The National Archives describes the census Soundex as a coded surname index based on the way a surname sounds rather than the way it is spelled. Surnames that sound the same but are spelled differently, such as Smith and Smyth, get the same code and are filed together. To search, you first work out the code of the name you want, then look under it.
That arrangement explains a detail of the Archives page that is easy to miss. Census takers recorded people under the head of the household, so knowing that person’s full name helps as much as knowing the surname you are chasing.
The method is older than computers. Wikipedia credits Robert C. Russell and Margaret King Odell with it and says it was patented in 1918 and 1922. The patent record for US1261167 shows a filing on 1917-10-25 and a grant on 1918-04-02. The later patent, US1435663, granted 1922-11-14, states the aim plainly: an index in which names are entered and grouped phonetically rather than by the alphabetical construction of the names.
Which census years used the code depends on whom you read. Wikipedia says a variation called American Soundex was used in the 1930s for a retrospective analysis of the censuses from 1890 through 1920. The PostgreSQL documentation says the census used it in 1880, 1900 and 1910. Two sources, two lists, so this page names no census years.
Soundex came to prominence in the 1960s, according to Wikipedia, through articles in the journals of the Association for Computing Machinery and a description in Donald Knuth’s book on sorting and searching. It is now the best known of the phonetic algorithms and ships with many database systems. The National Archives still maintains the rule set for the official version used by the United States government.
How a name becomes four characters
Every code is one letter and three numbers. The letter is the first letter of the surname, always. The numbers come from the remaining letters. If there are too few, zeros are added at the end, and if there are too many, the extra letters are disregarded. Washington becomes W-252: the W, then 2 for the S, 5 for the N and 2 for the G. Lee becomes L-000.
The digits come from a short table. B, F, P and V are 1. C, G, J, K, Q, S, X and Z are 2. D and T are 3, L is 4, M and N are 5, and R is 6. The vowels A, E, I, O and U, together with H, W and Y, get no digit. Wikipedia notes that consonants made at a similar place in the mouth share a digit, which is why the lip sounds B, F, P and V are all 1.
Neighbours need care. A double letter counts once, so Gutierrez is G-362. Different letters side by side with the same digit also count once, so in Pfister the F is ignored because it shares the digit of the P, and the code is P-236. Jackson becomes J-250: the C, the K and the S all carry a 2 and collapse into one.
Then come the two rules that are most often left out. If a vowel sits between two consonants with the same digit, the second one is coded again. Tymczak is T-522: the A separates the Z from the K, so the K gets its own 2. If H or W sits between them, nothing is coded again. Ashcraft is A-261, not A-226, because the H does not break the link between the S and the C.
Why do vowels separate and H and W not? Neither source gives a reason, and no source read for this page does. They state the rule and print examples, and the examples are what this page tests against. Anyone who wants a story for it is guessing.
One choice is the page’s own. The National Archives lists Y with the dropped letters and names only the five vowels as separators, while Wikipedia groups Y with H and W. This page treats Y like H and W and says so in its methods note.
Letters are read after Unicode decomposition. The Unicode equivalence article explains that an n followed by a combining tilde is defined as equivalent to the single character n with tilde, and the MDN page shows the same word in two forms that compare as unequal. Decomposing first, then dropping the combining marks, lets an accented letter count as its base letter. Anything else that is not A to Z is skipped and listed in the trace.
Where the two rules part
Wikipedia lists a second method, which it says most SQL implementations follow. Save the first letter. Map the vowels, H, W and Y to zero. Replace every consonant, the first letter included, with its digit. Collapse equal neighbours, then delete the zeros. Drop the leading digit if it equals the first letter’s digit. Pad with zeros or cut to three digits.
Take Ashcraft through both. Census rule: A is kept, S is 2, the H is dropped without clearing anything, the C is a 2 beside that remembered 2 and merges, R is 6, the second A clears the memory, F is 1, and the T would be a fourth digit, so it is cut. The code is A261. Simplified rule: the letters map to 0 2 0 2 6 0 1 3. No two equal digits touch, because the zero for H stands between the 2s. Remove the zeros and you hold 2 2 6 1 3, cut to three, so A226. The National Archives names exactly this wrong answer.
How often does the choice matter? For short strings it can be counted rather than sampled. Take the 13 letters A, B, C, D, H, K, M, R, S, T, W, Y and Z and build all 28561 four-letter strings. A short script, written apart from the page’s code, computes both codes for each one. In 2001 of 28561 the codes differ, about 7 percent.
The script also shows why. In every one of those 2001 strings, an H, W or Y sits between two letters that share a digit. That is the whole disagreement: the census rule lets the digit carry across, the simplified rule lets the zero cut it. Real names contain vowels, so the gap is smaller in practice, but it is real for any name with an H or W in the middle of a cluster.
A caution about the second method. Wikipedia states that it gives Tymczak as T520, yet the steps it lists, followed literally, give T522, the same as the census rule. This page treats that T520 statement as unconfirmed and does not repeat it. The simplified rule here is the listed steps, nothing more.
Where it fails, and what a match proves
Soundex was designed around English-language surnames. The PostgreSQL documentation says it is not very useful for non-English names and that its soundex function does not work well with multibyte encodings such as UTF-8. The Wikipedia article on phonetic algorithms makes the general point: most were developed for English, so they serve other languages less well.
Spelling variants can still fall apart. In the American Soundex column of the Wikipedia table for Daitch-Mokotoff Soundex, Moskowitz gets M232 and Moskovitz gets M213. The W has no digit and the V has a 1, so two spellings of one name land in different places. That table is a small piece of evidence for why genealogists Gary Mokotoff and Randy Daitch built their 1985 refinement for Slavic and Yiddish surnames, with six digits and several possible codes per name.
Spelling that looks close can also separate. Robert and Rupert share R163, but Rubin is R150. The first letter is kept as written, so names that start differently never meet: Knight is K523 and Night is N230, though they sound alike. Later work tried to repair such gaps. Wikipedia dates the New York State system to 1970 and quotes it as 2.7 percent more accurate than Soundex, and says Lawrence Philips published Metaphone in 1990. None of those is done here.
Prefixes need a human decision. The Archives says a name such as VanDeusen should be coded with and without the prefix, V-532 and D-250, because it may be filed under either. The page does not guess where a prefix ends. Type each version on its own line.
Finally, the match itself. Equal codes mean two names may sound alike by this crude measure. They do not mean the same person, the same family or even the same name: Smith and Smyth share S530, and so would many unrelated surnames. The PostgreSQL difference function reflects the idea, scoring how many of the four positions agree, from zero to four. Treat a shared code as a reason to look at the record, never as the answer.
The page does its heavy coding in a Web Worker, which MDN describes as a background thread separate from the main one, so a list of two thousand names does not freeze typing. The caps are stated on the page: 2,000 names of at most 60 letters each.
Sources
Every source consulted for this guide. Links checked November 9, 2026.
- The Soundex Indexing System US National Archives and Records Administration
- Soundex Wikipedia
- Daitch-Mokotoff Soundex Wikipedia
- Phonetic algorithm Wikipedia
- Metaphone Wikipedia
- New York State Identification and Intelligence System Wikipedia
- Unicode equivalence Wikipedia
- F.16. fuzzystrmatch, determine string similarities and distance The PostgreSQL Global Development Group
- US1261167A - Index Google Patents (US Patent Office record)
- US1435663A - Index Google Patents (US Patent Office record)
- Web Workers API MDN Web Docs, Mozilla contributors
- String.prototype.normalize() MDN Web Docs, Mozilla contributors