Linkernizer 1.2.0

dotnet add package Linkernizer --version 1.2.0
                    
NuGet\Install-Package Linkernizer -Version 1.2.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="Linkernizer" Version="1.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Linkernizer" Version="1.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Linkernizer" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Linkernizer --version 1.2.0
                    
#r "nuget: Linkernizer, 1.2.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.
#:package Linkernizer@1.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Linkernizer&version=1.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Linkernizer&version=1.2.0
                    
Install as a Cake Tool

Linkernizer

Welcome to Linkernizer, the (possibly best) .NET library for automatically linking URLs and email addresses.
It takes in plain text and wraps anything it considers a link with the HTML markup for a hyperlink / anchor.

You can use it like this:

var linkernizer = new Linkernizer();
var input = "Visit us at www.example.org or email us at mail@example.org!";
var output = linkernizer.Linkernize(input);
// Visit us at <a href="https://www.example.org">www.example.org</a> or email us at <a href="mailto:mail@example.org">mail@example.org</a>!

You can configure a few additional options like this:

var linkernizer = new Linkernizer(options => {
  options.OpenExternalLinksInNewTab = true; // inserts target="_blank" and rel="noopener"
  options.NoReferrerOnExternalLinks = true; // also adds noreferrer to the rel attribute
  options.InternalHost = "www.example.com"; // treat these as internal (no target or rel)
  options.DefaultScheme = "http://"; // use this scheme for links starting with www.
});

Why should I use or not use Linkernizer?

You should use it because:

  • It is fast (see the benchmarks below for more details)
  • It uses little memory (there are zero allocations after the setup when the input does not contain links)
  • It is thread-safe (instances are immutable after construction, so a single instance can be shared across the whole application)
  • It has only one dependency (to Microsoft.SourceLink.GitHub, which is only a build-time dependency)
  • It provides an interface so that it can be used via dependency injection

However, there are also some limitations:

  • Links are not validated against a full list of top-level domains (as this list will be outdated quickly)
  • Links are not validated against a full list of URI schemes (as these could change quickly as well)
  • Telephone numbers are not linked automatically (as this usually generates too many false positives for my taste)
  • It assumes the input does not already contain HTML (and will likely lead to invalid markup if this is not the case)

Installation

The library can be used like any other NuGet package. For example:

> dotnet add package Linkernizer

You can find more information on https://www.nuget.org/packages/Linkernizer.

Benchmarks

The benchmarks compare the following libraries in their default configuration:

The execution time (excluding initial setup):

Execution time

The memory allocated (excluding initial setup):

Memory allocated

Keep in mind that the exact values will vary from run to run.

| Method                         | Mean          | Error       | StdDev     | Gen0   | Allocated |
|------------------------------- |--------------:|------------:|-----------:|-------:|----------:|
| LinkernizerShortTextNoMatches  |      7.657 ns |   0.0631 ns |  0.0527 ns |      - |         - |
| LinkernizerLongTextNoMatches   |     37.645 ns |   0.2509 ns |  0.2347 ns |      - |         - |
| LinkernizerShortTextTwoMatches |    689.404 ns |   3.8499 ns |  3.6012 ns | 0.1163 |     488 B |
| LinkernizerLongTextFourMatches |  3,139.607 ns |  11.1179 ns |  8.6801 ns | 0.5264 |    2208 B |
|------------------------------- |--------------:|------------:|-----------:|-------:|----------:|
| AutoLinkShortTextNoMatches     |    913.125 ns |   5.3398 ns |  4.7336 ns | 0.0210 |      88 B |
| AutoLinkLongTextNoMatches      |  6,377.185 ns |  25.5865 ns | 23.9336 ns | 0.0153 |      88 B |
| AutoLinkShortTextTwoMatches    |  1,433.639 ns |   5.8996 ns |  5.2298 ns | 0.2937 |    1232 B |
| AutoLinkLongTextFourMatches    |  8,136.476 ns |  96.0548 ns | 89.8497 ns | 2.0142 |    8448 B |
|------------------------------- |--------------:|------------:|-----------:|-------:|----------:|
| TextHelperShortTextNoMatches   |  3,109.229 ns |  21.4969 ns | 20.1082 ns | 0.0381 |     168 B |
| TextHelperLongTextNoMatches    | 21,863.800 ns | 124.6723 ns | 97.3359 ns | 0.0305 |     168 B |
| TextHelperShortTextTwoMatches  |  4,264.676 ns |  31.5707 ns | 27.9866 ns | 0.2441 |    1040 B |
| TextHelperLongTextFourMatches  | 24,071.769 ns |  82.9393 ns | 69.2580 ns | 0.7324 |    3136 B |

You can verify the results by running the same benchmarks on your machine.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.0 101 6/22/2026
1.1.0 99 6/12/2026
1.0.6 102 5/25/2026
1.0.5 105 4/29/2026
1.0.4 97 4/29/2026
1.0.3 108 4/9/2026
1.0.2 125 2/27/2026
1.0.1 206 6/23/2025
1.0.0 221 6/23/2025