Does anyone knoe where I can look up which blocks of zip codes are assigned to which states.
I’m trying write a program that verifies that the state and zip entered by the user match each other.
Does anyone knoe where I can look up which blocks of zip codes are assigned to which states.
I’m trying write a program that verifies that the state and zip entered by the user match each other.
Last time I was at the post office, they had a big book that listed the zip codes in numerical order and the cities they were associated with. Might wanna start there.
These books are for sale. You might try the big chain stores, or office supply stores.
At the following site, USPS ZipCode Lookup By City or State, you should be able to do what you wish.
Um, here you go. Taken from my old UPS sort guide. But, you’re probably still going to want to look at an almanac or some state geography book to double check these. I could’ve made a typo somewhere.
01000 - 02799 = MA
02800 - 02999 = RI
03000 - 03899 = NH
03900 - 04999 = ME
05000 - 05999 = VT
06000 - 06999 = CT
07000 - 08999 = NJ
09000 - 14999 = NY
15000 - 19699 = PA
19700 - 19999 = DE
20000 - 20330, 20332 - 20599 = DC
20600 - 21999, 20331 = MD
22000 - 24699 = VA
24700 - 26899 = WV
27000 - 28999 = NC
29000 - 29999 = SC
30000 - 31999 = GA
32000 - 34999 = FL
35000 - 36999 = AL
37000 - 38599 = TN
38600 - 39799 = MS
40000 - 42799 = KY
43000 - 45899 = OH
46000 - 47999 = IN
48000 - 49935, 49937 - 49999 = MI
50000 - 52899 = IA
53000 - 54999, 49936 = WI
55000 - 56799 = MN
57000 - 57799 = SD
58000 - 58899 = ND
59000 - 59999 = MT
60000 - 62999 = IL
63000 - 65899 = MO
66000 - 67999 = KS
68000 - 69399 = NE
70000 - 71499 = LA
71600 - 72999, 75502 = AR
73000 - 74999 = OK
75000 - 75501, 75503 - 79999 = TX
80000 - 81699 = CO
82000 - 83199 = WY
83200 - 83899 = ID
84000 - 84799 = UT
85000 - 86599 = AZ
87000 - 88499 = NM
89000 - 89899 = NV
90000 - 96699 = CA
96700 - 96899 = HI
97000 - 97999 = OR
98000 - 98732, 98734 - 98735, 98737 - 98776, 98778 - 98790, 98792 - 99499 = WA
98733, 98736, 98777, 98791, 99500 - 99999 = AK
Start with vandal’s list, then double check it against the book in the local Post Office lobby, and repeat the process EACH YEAR.
Zip codes are not carved in stone. They change as smaller population centers experience rapid growth. (E.G., Sometime in the (late?) 80s, a portion of Westchester County north of New York City was given a Zip code range that had nothing in common with the rest of the state of New York. After a few years (mid- to late-90s?), the USPS went in and gave them all new numbers in the New York range.)
BTW, if you are doing this for a company (rather than something you are personally writing for a friend or your own business), see whether your billing department is already using Vertex software to calculate sales taxes or your mail room is already using USPS-affiliated software to lower their postal rates. There are several companies that provide this information as part of a larger service (and keep it updated monthly) and if your company is already paying for the service, it is generally not a problem to tap into their database (at the least) or actually link to the software (if your are not expanding the use beyond the contract).
So where is 75502?
I don’t know the specific numbers, but there are apparently a couple that cross state boundaries, too:
This was from a census bureau paper on “Geographic Coding of Administrative Records–Past Experience and Current
Research”:
http://www.census.gov/population/www/documentation/twps0002/twps0002.html
We used to have a tax accountant who always fussed about us using Zip codes to determine sales tax because of “all the Zip codes that cross state boundaries.” Finally, I went out and looked them up. There were (at that time) exactly six such Zips and the people in the “wrong state” covered by all six of those Zips numbered maybe 1,500.
It is a valid point regarding pure accuracy, but in real life terms, it usually cost more to account for the discrepancies than it does to manually correct the very rare errors.
(Using Zip codes for sales tax does create a problem when a Zip covers a county lacking a tax as well as a city that has one, but that is a slightly different issue.)
From the USPS site:
Depending on why you are doing this, make sure you don’t forget APO and FPO. When I was serving with the USAF my bank had trouble sending me my statement because they forgot about this.
I don’t doubt that it’s a small number, but if I were coding a validation routine from scratch, having found this info, I might still design my database of zip codes to be able to accomodate multiple states for some zip codes. Particularly if I’m using it as validation for an online form where I’m going to refuse to accept the input unless my validation routine believes the state-to-zip matching.
I agree that it probably won’t hurt you much - maybe your online store loses a couple potential customers who give up in frustration. The unfortunate people living in those areas probably deal with it all the time.
Oh, and I agree with tomndebb that you should see if you are already making use of a service which provides the translation, and use them if your license allows it, since they will keep it updated.
Just a recommendation from personal experience. You may want to warn them if the state and zip code don’t match, rather than outright reject them. Sometimes the user knows best…
For instance, I was trying to buy something from an e-commerce site once, and rejected my credit card! Why? Because the expiration date had to be in the range of 1999-2003, and mine was a brand new card with a 2004 date. They were trying to get just a sanity check, but it didn’t really work out for them. If they had just warned me, it would have worked fine.
Last I heard, Fishers Island, NY, had a ZIP Code 06390, more like CT ZIPs, which makes sense because the town is just off the Connecticut shore and farther away from any New York post office.
When I went to Seal Beach, Orange County, CA, to apply to work as a letter carrier in OC, I found that, as far as the USPS is concerned, Seal Beach (ZIP 90740) is in Los Angeles County! That’s baffling, since Seal Beach is in Orange County, but, hey, that’s the way they do it!
I had a hunch since that last post that maybe 75501 (assigned to Texas) was Texarkana, TX, and that 75502 (assigned to Arkansas) was Texarkana, AR. So, we go to the site recommended by DSYoungEsq and get the following results for Texarkana, TX:
TEXARKANA TX is associated with following ZIP Codes:
75501
75503
75504
75505
75507
75599
(edited for readability)
But this result for Texarkana, AR:
TEXARKANA AR is associated with the following ZIP Codes:
71854
(edited for readability)
So, my hypothesis was half-right; 75501, as well as 75503 and 75504, are Texarkana, TX. But so much for Texarkana, AR. 75502, like tomndebb reported, seems to be assigned to the aether. Based on these results, however, I’d WAG that it was supposed to be assigned to Texarkana, AR.
Alright, we’ll just beat 75502 to death here…
Some zip code combinations aren’t in use, but rather reserved for future use as tomndebb has pointed out. So, with the case of 75502, whatever city in AR whose population is growing, that city could be assigned 75502 (or any other combination that is not in use). Arkansas covers 71600 - 72999 (and 75502), but that doesn’t mean that all 1399 combinations are taken.
Interestingly though, the 1997 World Almanac gives the Texarkana, Arkansas, Zip as 75502, while the 1999 edition gives it as 71854. So Pantellerite’s hypothesis appears correct, except that the USPS seems to have gone in and tidied up somewhat.