Forum Moderators: phranque
U.S. Gazetteer: 2000 and 1990 [census.gov]
T I G E R [census.gov]
I haven't used it, myself, but I will warn you I've heard it's not entirely up-to-date or thorough.
(You get what you pay for... in other words).
However, most of the cheap zip code lists are inaccurate to start with, and unless you go with a very expensive solution, you won't be getting anything very accurate. Even when accurate, those are only centroids- the center most point inside a zip/postal code- customers can be quite a bit away from the center of the postal code.
Not only that, those distances are not driving distances. When I used online dating sites, they consistently messed up distance from my home because they didn't account for the harbour. I could swim there as fast as I could walk there.
All that to say... this is not incredibly accurate, so I wouldn't sweat the small stuff. It's more important to get the UI in a decent shape then fret about theoretical accuracy.
Regarding the calcs...
One of my first web-based trigonmetric applications was a distance calculator. I enjoyed the project tremendously and did some extensive testing on formulas.
I prefer a second version of the Haversine formula developed by Bob Chamberlain. It will give mathematically and computationally exact results, except when the two points are antipodal (on opposite sides of the Earth), then the formula is ill-conditioned, but the error, perhaps as large as 1 mile, is in the context of a distance near 12,000 miles. Bob has graciously granted use of the formula with no more than a humble request of recognition and a link to the census bureau site...
Mr. Chamberlain's discussion and the formula:
[census.gov...]
[zipcodeworld.com...]
You can subscribe full zip code database with latitude and longitude from [zipcodeworld.com...]