You're all set!

To start developing, please head over to our developer documentation.

Activate the Google Maps Geocoding API

To get you started we'll guide you through the Google Developers Console to do a few things first:

  1. Create or choose a project
  2. Activate the Google Maps Geocoding API
  3. Create appropriate keys
Continue

Getting Started

The Google Maps Geocoding API is a service that provides geocoding and reverse geocoding of addresses.

This service is also available as part of the Google Maps JavaScript API, or the Java, Python, and Go client libraries.

Geocoding is the process of converting addresses (like a street address) into geographic coordinates (like latitude and longitude), which you can use to place markers on a map, or position the map.

Reverse geocoding is the process of converting geographic coordinates into a human-readable address. The Google Maps Geocoding API's reverse geocoding service also lets you find the address for a given place ID.

Sample request and response

You access the Google Maps Geocoding API through an HTTP interface. Following are examples of geocoding and reverse geocoding requests.

Geocoding request and response (latitude/longitude lookup)

The following example requests the latitude and longitude of "1600 Amphitheatre Parkway, Mountain View, CA", and specifies that the output must be in JSON format.

https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&key=YOUR_API_KEY

You can test this by entering the URL into your web browser (be sure to replace ‘YOUR_API_KEY’ with your actual API key). The response includes the latitude and longitude of the address.

View the developer's guide for more information about building geocoding request URLs and available parameters and understanding the response.

Below is a sample geocoding response, in JSON:

{
   "results" : [
      {
         "address_components" : [
            {
               "long_name" : "1600",
               "short_name" : "1600",
               "types" : [ "street_number" ]
            },
            {
               "long_name" : "Amphitheatre Pkwy",
               "short_name" : "Amphitheatre Pkwy",
               "types" : [ "route" ]
            },
            {
               "long_name" : "Mountain View",
               "short_name" : "Mountain View",
               "types" : [ "locality", "political" ]
            },
            {
               "long_name" : "Santa Clara County",
               "short_name" : "Santa Clara County",
               "types" : [ "administrative_area_level_2", "political" ]
            },
            {
               "long_name" : "California",
               "short_name" : "CA",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "United States",
               "short_name" : "US",
               "types" : [ "country", "political" ]
            },
            {
               "long_name" : "94043",
               "short_name" : "94043",
               "types" : [ "postal_code" ]
            }
         ],
         "formatted_address" : "1600 Amphitheatre Parkway, Mountain View, CA 94043, USA",
         "geometry" : {
            "location" : {
               "lat" : 37.4224764,
               "lng" : -122.0842499
            },
            "location_type" : "ROOFTOP",
            "viewport" : {
               "northeast" : {
                  "lat" : 37.4238253802915,
                  "lng" : -122.0829009197085
               },
               "southwest" : {
                  "lat" : 37.4211274197085,
                  "lng" : -122.0855988802915
               }
            }
         },
         "place_id" : "ChIJ2eUgeAK6j4ARbn5u_wAGqWA",
         "types" : [ "street_address" ]
      }
   ],
   "status" : "OK"
}

Reverse geocoding request and response (address lookup)

The following example requests the address corresponding to a given latitude/longitude in Brooklyn, NY, USA. It specifies that the output must be in JSON format.

https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&key=YOUR_API_KEY

You can test this by entering the URL into your web browser (be sure to replace ‘YOUR_API_KEY’ with your actual API key). The response includes a human-readable address for the latitude and longitude location.

View the developer's guide for more information about building reverse geocoding request URLs and available parameters and understanding the response.

Below is a sample reverse geocoding response, in JSON:

{
   "results" : [
      {
         "address_components" : [
            {
               "long_name" : "277",
               "short_name" : "277",
               "types" : [ "street_number" ]
            },
            {
               "long_name" : "Bedford Avenue",
               "short_name" : "Bedford Ave",
               "types" : [ "route" ]
            },
            {
               "long_name" : "Williamsburg",
               "short_name" : "Williamsburg",
               "types" : [ "neighborhood", "political" ]
            },
            {
               "long_name" : "Brooklyn",
               "short_name" : "Brooklyn",
               "types" : [ "sublocality", "political" ]
            },
            {
               "long_name" : "Kings",
               "short_name" : "Kings",
               "types" : [ "administrative_area_level_2", "political" ]
            },
            {
               "long_name" : "New York",
               "short_name" : "NY",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "United States",
               "short_name" : "US",
               "types" : [ "country", "political" ]
            },
            {
               "long_name" : "11211",
               "short_name" : "11211",
               "types" : [ "postal_code" ]
            }
         ],
         "formatted_address" : "277 Bedford Avenue, Brooklyn, NY 11211, USA",
         "geometry" : {
            "location" : {
               "lat" : 40.714232,
               "lng" : -73.9612889
            },
            "location_type" : "ROOFTOP",
            "viewport" : {
               "northeast" : {
                  "lat" : 40.7155809802915,
                  "lng" : -73.9599399197085
               },
               "southwest" : {
                  "lat" : 40.7128830197085,
                  "lng" : -73.96263788029151
               }
            }
         },
         "place_id" : "ChIJd8BlQ2BZwokRAFUEcm_qrcA",
         "types" : [ "street_address" ]
      },

   ... Additional results truncated in this example[] ...

   ],
   "status" : "OK"
}

Start coding with our client libraries

Client libraries make developing with the Google Maps web service APIs easier by providing simple, native implementations of common tasks, such as authentication, request throttling and automatic retry. The Google Maps Geocoding API is available as part of the Java Client for Google Maps Services, Python Client for Google Maps Services, and Go Client for Google Maps Services.

These community-supported client libraries are open-sourced under the Apache 2.0 License and are available for download, or contributions, on GitHub. The libraries are not covered by the standard Google deprecation policy, or support agreement.

Authentication, quotas, and policies

Activate the API and get an API key

To use the Google Maps Geocoding API, you must first activate the API in the Google API Console and obtain the proper authentication credentials. You need to provide a server API key in each request (or a client ID if you have a Premium Plan).

Click the button below to flow through a process where you will:

  1. Create or select a project
  2. Enable the API
  3. Get an API key
Get a Key

Learn more about authentication credentials.

Quotas

Review the usage limits page for details on the quotas set for the Google Maps Geocoding API.

Policies

Use of the Google Maps Geocoding API must be in accordance with the API policies.

Learn more

There’s more you can do with the Geocoding API. See the Geocoding API developer’s guide for additional demos, examples, available parameters, status codes and error messages, and other details.

Send feedback about...

Google Maps Geocoding API
Google Maps Geocoding API
Need help? Visit our support page.