
Learn how to geolocate an IP address using GeoIP and GeoLite databases, or GeoIP
and GeoLite web services with server or client side API calls.

<!-- prettier-ignore-start -->

### Guides


- heading: "Databases"
  url: "/geoip/geolocate-an-ip/databases"
  text: "Geolocate an IP address using GeoIP or GeoLite databases."
- heading: "Web Services"
  url: "/geoip/geolocate-an-ip/web-services"
  text: "Geolocate an IP address using GeoIP or GeoLite web services using a server-side API call."
- heading: "Client-side Javascript"
  url: "/geoip/geolocate-an-ip/client-side-javascript"
  text: "Geolocate an IP address using GeoIP or GeoLite web services using client-side JavaScript."


<!-- prettier-ignore-end -->

## [Geolocate an IP address using Databases](/geoip/geolocate-an-ip/databases/)
<p>Geolocating an IP address using GeoIP and GeoLite databases consists of
configuring a database reader and querying the database.</p>
## Implementation
<p>MaxMind offers and highly recommends using
[official client libraries](/geoip/docs/databases#official-client-apis) to query
our databases.</p>
### 1. Install the GeoIP client library
<p>We have a collection of officially supported libraries for you to query with the
GeoIP and GeoLite databases:</p>


```csharp
// Install via NuGet
Install-Package MaxMind.GeoIP2
```

```java
// Install via Maven, recommended
<dependency>
  <groupId>com.maxmind.geoip2</groupId>
  <artifactId>geoip2</artifactId>
  <version>5.1.0</version>
</dependency>

// Or install via Gradle
repositories {
  mavenCentral()
}
dependencies {
  implementation 'com.maxmind.geoip2:geoip2:5.1.0'
}
```

```javascript
// Install via npm
npm install @maxmind/geoip2-node

// Or install via yarn
yarn add @maxmind/geoip2-node
```

```php
# Install via Composer
composer require geoip2/geoip2:~3.0
```

```python
# Install via pip
pip install geoip2
```

```ruby
# Install as a gem
gem install maxmind-geoip2

# Or add this to your Gemfile
gem 'maxmind-geoip2'
```


### 2. Configure a GeoIP database reader to query the database
<p>Configuring the database reader requires the database file to be accessible on
the filesystem. After configuring the database reader, you can then query the
database by calling the method corresponding to the database type (e.g. <code>city</code>
or <code>country</code>) and passing it the IP address you want to look up.</p>

## [Geolocate an IP address using Web Services](/geoip/geolocate-an-ip/web-services/)
<p>Geolocating an IP address using GeoIP or GeoLite web services consists of
configuring a web service client, creating a request, and handling the response.</p>
## Implementation
<p>MaxMind offers and highly recommends using
[official client libraries](/geoip/docs/web-services#client-apis) to access our
geolocation services. If you cannot or do not wish to use our client libraries,
please review our [GeoIP API Documentation page](/geoip/docs/web-services/) for
details on our REST API.</p>
### 1. Install the GeoIP client library
<p>We have a collection of officially supported libraries for you to interact with
the GeoIP and GeoLite APIs:</p>

## [Geolocate an IP address using Web Services with the client-side JavaScript](/geoip/geolocate-an-ip/client-side-javascript/)
<p>Our GeoIP JavaScript client allows you to use GeoIP web services client-side
without doing any server-side integration on your end. While it is convenient,
there are some caveats with its usage. Some browser settings and add-ons (such
as ad blockers) may prevent the GeoIP JavaScript API from successfully calling
the web services. Additionally, there may be unexpected usage spikes which you
may want to monitor, due to moments of high traffic to your website(s).</p>

