IPAddressRange 6.0.0

dotnet add package IPAddressRange --version 6.0.0
NuGet\Install-Package IPAddressRange -Version 6.0.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="IPAddressRange" Version="6.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add IPAddressRange --version 6.0.0
#r "nuget: IPAddressRange, 6.0.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 IPAddressRange as a Cake Addin
#addin nuget:?package=IPAddressRange&version=6.0.0

// Install IPAddressRange as a Cake Tool
#tool nuget:?package=IPAddressRange&version=6.0.0

IPAddressRange Class Library tests NuGet Package

This library allows you to parse range of IP address string such as "" and "" and "", and can contains check. This library supports both IPv4 and IPv6.


using NetTools;
// rangeA.Begin is "", and rangeA.End is "".
var rangeA = IPAddressRange.Parse("");
rangeA.Contains(IPAddress.Parse("")); // is True.
rangeA.Contains(IPAddress.Parse("")); // is False.
rangeA.ToCidrString(); // is

// rangeB.Begin is "", and rangeB.End is "".
var rangeB1 = IPAddressRange.Parse(" -");
rangeB1.Contains(IPAddress.Parse("")); // is True.
rangeB1.Contains(IPAddress.Parse("")); // is False.

// Support shortcut range description. 
// ("" means range of begin: to end:
var rangeB2 = IPAddressRange.Parse("");

// Support CIDR expression and IPv6.
var rangeC = IPAddressRange.Parse("fe80::/10"); 
rangeC.Contains(IPAddress.Parse("fe80::d503:4ee:3882:c586%3")); // is True.
rangeC.Contains(IPAddress.Parse("::1")); // is False.

// "Contains()" method also support IPAddressRange argument.
var rangeD1 = IPAddressRange.Parse("");
var rangeD2 = IPAddressRange.Parse("");
rangeD1.Contains(rangeD2); // is True.

// IEnumerable<IPAddress> support, it's lazy evaluation.
foreach (var ip in IPAddressRange.Parse(""))

// You can use LINQ via "AsEnumerable()" method.
var longValues = IPAddressRange.Parse("")
  .Select(ip => BitConvert.ToInt32(ip.GetAddressBytes(), 0))
  .Select(adr => adr.ToString("X8"));
Console.WriteLine(string.Join(",", longValues);

// Constructors from IPAddress objects.
var ipBegin = IPAddress.Parse("");
var ipEnd = IPAddress.Parse("");
var ipSubnet = IPAddress.Parse("");

var rangeE = new IPAddressRange(); // This means "".
var rangeF = new IPAddressRange(ipBegin, ipEnd);
var rangeG = new IPAddressRange(ipBegin, maskLength: 24);
var rangeH = new IPAddressRange(ipBegin, IPAddressRange.SubnetMaskLength(ipSubnet));

// Calculates Cidr subnets
var rangeI = IPAddressRange.Parse("");
rangeI.ToCidrString();  // is

Release Note

The release notes is here.


Mozilla Public License 2.0

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  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 netcoreapp1.0 was computed.  netcoreapp1.1 was computed.  netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard1.4 is compatible.  netstandard1.5 was computed.  netstandard1.6 was computed.  netstandard2.0 was computed.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 is compatible.  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 tizen30 was computed.  tizen40 was computed.  tizen60 was computed. 
Universal Windows Platform uap was computed.  uap10.0 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.
  • .NETFramework 4.6.2

    • No dependencies.
  • .NETStandard 1.4

  • .NETStandard 2.1

    • No dependencies.
  • net5.0

    • No dependencies.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages (34)

Showing the top 5 NuGet packages that depend on IPAddressRange:

Package Downloads

Ocelot is an API Gateway. The project is aimed at people using .NET running a micro services / service orientated architecture that need a unified point of entry into their system. In particular I want easy integration with IdentityServer reference and bearer tokens. reference tokens. Ocelot is a bunch of middlewares in a specific order. Ocelot manipulates the HttpRequest object into a state specified by its configuration until it reaches a request builder middleware where it creates a HttpRequestMessage object which is used to make a request to a downstream service. The middleware that makes the request is the last thing in the Ocelot pipeline. It does not call the next middleware. The response from the downstream service is stored in a per request scoped repository and retrived as the requests goes back up the Ocelot pipeline. There is a piece of middleware that maps the HttpResponseMessage onto the HttpResponse object and that is returned to the client. That is basically it with a bunch of other features.


This library is a WHOIS protocol client used to search owner information by IP address or domain name. This library determines the WHOIS server automatically and queries the referral server recursively. The response of the whois query contains strongly typed values, and the raw output.


A middleware that allows whitelist or blacklist incomming requests based on IP address. It can be configured using single IP address or ranges. It supports single IP, IP range IPv4 and IPv6. There is also possible to ignore specific paths from IP filtering.


DNTCommon.Web.Core provides common scenarios' solutions for ASP.NET Core applications.


Package Description

GitHub repositories (9)

Showing the top 5 popular GitHub repositories that depend on IPAddressRange:

Repository Stars
.NET API Gateway
A modern client-server application for the Soulseek file sharing network.
Viper 是一个基于Anno微服务引擎开发的Dashboard示例项目。Anno 底层通讯采用 grpc、thrift。自带服务发现、调用链追踪、Cron 调度、限流、事件总线等等
🌈An enhanced version with clean architecture of asp.netcore,efficiently manage startup,Support for netcore3.1/6.0
Tool that limits bandwidth of devices on the same network without access.
Version Downloads Last updated
6.0.0 1,323,039 6/1/2023
4.0.0 2,195,186 8/31/2019
3.2.2 228,462 8/12/2019
3.2.1 249,807 6/26/2019
3.2.0 1,261,491 5/1/2018
3.1.1 7,477 4/26/2018
3.1.0 67,635 3/22/2018 9,932 3/3/2018
3.0.0-beta 1,554 2/23/2018
2.2.0 14,505 1/29/2018
2.1.1 77,447 11/28/2017
2.1.1-beta 1,674 11/20/2017 56,247 11/16/2017
2.1.0-alpha 1,653 11/1/2017 165,754 9/15/2017 127,121 7/4/2017 1,632 5/29/2017
2.0.0-beta 1,856 5/19/2017 56,794 3/8/2017 1,586 3/1/2017 2,267 11/29/2016
1.6.1 74,735 9/27/2016
1.6.0 41,584 5/23/2016
1.5.0 203,631 10/16/2015 5,739 8/22/2015
1.4.0 23,292 6/3/2015 4,146 4/1/2015
1.3.0 1,907 4/1/2015
1.2.1 4,680 2/19/2015
1.2.0 61,473 2/5/2015
1.1.0-beta 3,154 11/4/2014
1.0.6 14,824 3/10/2014
1.0.5 3,559 12/9/2013
1.0.4 1,992 12/9/2013
1.0.3 1,991 12/9/2013
1.0.2 12,136 5/28/2012
1.0.1 3,058 5/22/2012
1.0.0 3,431 5/17/2012

- Update the target frameworks (Drop the support for .NET4.5.2)
- Fix: Enumerating never breaks if the end of the IPv4 address range is "" (Issue #80)

To see all the change logs, please visit the following URL.
- https://github.com/jsakamoto/IPAddressRange/blob/master/RELEASE-NOTES.txt