# Find city, state from supplied ZIP Code

**URL:** <https://www.ruby-forum.com/t/find-city-state-from-supplied-zip-code/126885>\
**Category:** Rails\
**Created:** [January 23, 2008, 2:35am UTC](https://www.ruby-forum.com/t/find-city-state-from-supplied-zip-code/126885 "2008-01-23T02:35:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e19b73/32.png) [@jeff](https://www.ruby-forum.com/u/jeff)\
**Post date:** [January 23, 2008, 2:35am UTC](https://www.ruby-forum.com/t/find-city-state-from-supplied-zip-code/126885/1 "2008-01-23T02:35:27Z")

</div>

Is there a simple solution available that would allow me to take a ZIP  
Code from a user and then populate City and State fields based on that  
ZIP?

Any kind of a plugin, for example?

---

<div class="post-metadata">

**Author:** ![jeff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e19b73/32.png) [@jeff](https://www.ruby-forum.com/u/jeff)\
**Post date:** [January 23, 2008, 3:21am UTC](https://www.ruby-forum.com/t/find-city-state-from-supplied-zip-code/126885/2 "2008-01-23T03:21:02Z")

</div>

geokit

uses google to geocode the addresses… and if you only give it a zip  
it should return the city and state

---

<div class="post-metadata">

**Author:** ![jeff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e19b73/32.png) [@jeff](https://www.ruby-forum.com/u/jeff)\
**Post date:** [February 5, 2008, 12:56am UTC](https://www.ruby-forum.com/t/find-city-state-from-supplied-zip-code/126885/3 "2008-02-05T00:56:06Z")

</div>

Or, I have a CSV will all the zip codes of the US: code, lat, lng,  
city, state, county.

MUCH faster than geocoding it, unless you need the greater precision  
of geocoding the entire address.

Drop me an email if you would like it.

---

<div class="post-metadata">

**Author:** ![jeff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e19b73/32.png) [@jeff](https://www.ruby-forum.com/u/jeff)\
**Post date:** [February 8, 2008, 2:04am UTC](https://www.ruby-forum.com/t/find-city-state-from-supplied-zip-code/126885/4 "2008-02-08T02:04:11Z")

</div>

Karl S. wrote:

> Or, I have a CSV will all the zip codes of the US: code, lat, lng,  
> city, state, county.
> 
> MUCH faster than geocoding it, unless you need the greater precision  
> of geocoding the entire address.
> 
> Drop me an email if you would like it.

Bear in mind that ZIP codes change. They get merged, split, and  
deprecated pretty often. It’s probably best to ‘outsource’ the job to  
someone like Google.
