# Maximum mathematical variation between non-government, non-state, physically contiguous zip codes?

I'm programming a matching list for street addresses, and I'm trying to prioritize different aspects of the address based on likelihood of similarity if both addresses are the same physical location. I'm allowing for the zip code to be in any physically contiguous zip code (that doesn't cross a state line) and still be considered a match, but this is where the problem starts.

The first digit of the zip code is obviously a very high priority, but beyond that, I have no idea what the maximum difference is between physically contiguous zip codes within the same state, and not including weird outliers like the IRS zip code. If there are, say 94000 next to 95000, then I need to de-prioritize the second through fifth zip code digits. If, however, the largest difference is 94100 to 94200, I only need to de-prioritize the third through fifth digits.

Any idea of either the answer or how I could go about finding this out?

• You might find some useful information in the Wikipedia article en.wikipedia.org/wiki/ZIP_Code – Bjorn Jul 22 '19 at 14:55
• Some ZIP codes cross state lines. Ignoring that fact could lead to some errors. – P.T. Curran Jul 22 '19 at 19:07
• @P.T.Curran I failed to mention that I was prioritizing state over zip, which I suppose is vital info. :) So that divide should be made already by the time it gets to the second or third digit of the zip. – Carduus Jul 23 '19 at 12:53
• @Bjorn I've created a GEOJSON shapemap of zips already, I just don't want to spend hours going over the US by eye. – Carduus Jul 23 '19 at 12:54
• From what I understand most states will not have the same first 2 digits of their ZIP code throughout Here's a map over at Wikipedia showing the first 3 digits of ZIP codes for each state/territory in the US. en.wikipedia.org/wiki/ZIP_Code#/media/File:ZIP_Code_zones.svg – P.T. Curran Jul 26 '19 at 17:38