MaxMind.Db 4.1.0

The ID prefix of this package has been reserved for one of the owners of this package by Prefix Reserved
dotnet add package MaxMind.Db --version 4.1.0
NuGet\Install-Package MaxMind.Db -Version 4.1.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MaxMind.Db" Version="4.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MaxMind.Db --version 4.1.0
#r "nuget: MaxMind.Db, 4.1.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MaxMind.Db as a Cake Addin
#addin nuget:?package=MaxMind.Db&version=4.1.0

// Install MaxMind.Db as a Cake Tool
#tool nuget:?package=MaxMind.Db&version=4.1.0

MaxMind DB Reader

NuGet API Docs


This is the .NET API for reading MaxMind DB files. MaxMind DB is a binary file format that stores data indexed by IP address subnets (IPv4 or IPv6).



We recommend installing this library with NuGet. To do this, type the following into the Visual Studio Package Manager Console:

install-package MaxMind.Db


Note: For accessing MaxMind GeoIP2 databases, we generally recommend using the GeoIP2 .NET API rather than using this package directly.

To use the API, you must first create a Reader object. The constructor for the reader object takes a string with the path to the MaxMind DB file. Optionally you may pass a second parameter with a FileAccessMode enum with the value MemoryMapped or Memory. The default mode is MemoryMapped, which maps the file to virtual memory. This often provides performance comparable to loading the file into real memory with the Memory mode while using significantly less memory.

To look up an IP address, pass a System.Net.IPAddress object to the Find<T> method on Reader. This method will return the result as type T. T may either be a generic collection or a class using the [MaxMind.Db.Constructor] attribute to declare which constructor to use during deserialization and the [MaxMind.Db.Parameter("name")] to map the database key name to a particular constructor parameter.

We recommend reusing the Reader object rather than creating a new one for each lookup. The creation of this object is relatively expensive as it must read in metadata for the file.

Example Decoding to a Dictionary

using (var reader = new Reader("GeoIP2-City.mmdb"))
    var ip = IPAddress.Parse("");
    var data = reader.Find<Dictionary<string, object>>(ip);

Example Decoding to a Model Class

using MaxMind.Db;
using System.Net;

namespace MyCode
    public class Asn
        public AsnResponse(
            // The Parameter attribute tells the reader to map the database
            // key to the specified constructor parameter.
            [Parameter("autonomous_system_number")] long? autonomousSystemNumber,
            [Parameter("autonomous_system_organization")] string autonomousSystemOrganization,

            // The Inject attribute allows you to inject arbitrary values
            // when deserializing.
            [Inject("ip_address")] IPAddress ipAddress),

            // The Network attribute tells the reader to set the constructor
            // parameter to be the network associated with the record in the
            // database.
            [Network] Network network


    public class Program
        private static void Main(string[] args)
            using (var reader = new Reader("GeoLite2-ASN.mmdb"))
                var ip = IPAddress.Parse("");
                var injectables = new InjectableValues();
                injectables.AddValue("ip_address", ip);
                var data = reader.Find<Asn>(ip, injectables);

Multi-Threaded Use

This API fully supports use in multi-threaded applications. In such applications, we suggest creating one Reader object and sharing that among threads.


The MaxMind DB format is an open format for quickly mapping IP addresses to records. See the specification for more information on the format.

Bug Tracker

Please report all issues with this code using the GitHub issue tracker.

If you are having an issue with a MaxMind database or service that is not specific to this reader, please contact MaxMind support.


Patches and pull requests are encouraged. Please include unit tests whenever possible.


The MaxMind DB Reader API uses Semantic Versioning.

This software is Copyright (c) 2013-2022 by MaxMind, Inc.

This is free software, licensed under the Apache License, Version 2.0.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages (10)

Showing the top 5 NuGet packages that depend on MaxMind.Db:

Package Downloads
MaxMind.GeoIP2 The ID prefix of this package has been reserved for one of the owners of this package by

MaxMind GeoIP2 Database Reader and Web Service Client


Package Description


Providers and dependencies for web tracking


Contains the core assemblies needed to run nopcommerce. This package only contains assemblies and can be used for package development.


Useful utilities to more efficient .NET development #OnTheShouldersOfGiants

GitHub repositories (7)

Showing the top 5 popular GitHub repositories that depend on MaxMind.Db:

Repository Stars
Open Source ASP.NET MVC Enterprise eCommerce Shopping Cart Solution
A cross-platform GUI wrapper for NextTrace. Bringing you the familiar traceroute experience. OpenTrace 是 NextTrace 的跨平台 GUI 界面,带来您熟悉但更强大的用户体验。
A modular, scalable and ultra-fast open-source all-in-one eCommerce platform built on ASP.NET Core 7
Xeno-RAT is an open-source remote access tool (RAT) developed in C#, providing a comprehensive set of features for remote system management. Has features such as HVNC, live microphone, reverse proxy, and much much more!
Windows Firewall Notifier extends the default Windows embedded firewall by allowing to handle and notify about outgoing connections, offers real time connections monitoring, connections map, bandwidth usage monitoring and more...
Version Downloads Last updated
4.1.0 332,590 12/5/2023
4.0.0 2,741,521 2/3/2022
3.0.0 2,114,358 11/16/2020
2.6.1 2,932,412 12/6/2019
2.6.0 1,355 12/6/2019
2.5.0 6,352 11/21/2019
2.4.0 3,306,964 4/11/2018
2.3.0 1,327,883 10/27/2017
2.2.0 245,063 5/8/2017
2.1.3 569,738 11/22/2016
2.1.2 196,390 8/8/2016
2.1.1 6,183 8/1/2016
2.1.1-beta1 4,048 6/1/2016
2.1.0-beta4 1,832 6/1/2016
2.1.0-beta3 3,281 5/12/2016
2.1.0-beta2 1,940 5/10/2016
2.1.0-beta1 1,627 5/10/2016
2.0.0 646,604 4/15/2016
2.0.0-beta3 1,893 3/24/2016
2.0.0-beta2 8,190 1/29/2016
2.0.0-beta1 3,053 1/18/2016
1.2.0 165,567 9/23/2015
1.2.0-beta1 2,812 9/8/2015
1.1.0 50,948 7/21/2015
1.1.0-beta1 2,855 6/30/2015
1.0.1 195,756 5/19/2015
1.0.0 251,376 9/29/2014
0.3.0 4,795 9/24/2014
0.2.3 59,099 4/9/2014
0.2.2 37,814 12/24/2013
0.2.1 15,775 11/15/2013
0.2.0 3,696 10/25/2013
0.1.0 3,611 10/22/2013