shortid 3.0.1

.NET Standard 1.0
There is a newer version of this package available.
See the version list below for details.
dotnet add package shortid --version 3.0.1
NuGet\Install-Package shortid -Version 3.0.1
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="shortid" Version="3.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add shortid --version 3.0.1
#r "nuget: shortid, 3.0.1"
#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 shortid as a Cake Addin
#addin nuget:?package=shortid&version=3.0.1

// Install shortid as a Cake Tool
#tool nuget:?package=shortid&version=3.0.1


Build Status License: MIT NuGet Badge Coverage Status

About ShortId

A CSharp library to generate completely random short id's. They can be used as primary keys or unique identifiers. This library is different in that you can specify the length of the ids to be generated. This library is thread-safe and can generate millions of unique ids across multiple threads.

Getting Started

To make use of the shortid, add it to your project via the Nuget package manager UI or console via this command:

Package Manager
Install-Package shortid
> dotnet add package shortid
<PackageReference Include="shortid" />


Add the following using command to the top of your csharp code file:

using shortid;
using shortid.Configuration;

This gives your code access the classes and methods of the shortid namespace.

To generate a unique id of any length between 8 and 15, you call the Generate method without parameters.

string id = ShortId.Generate();
// id = KXTR_VzGVUoOY

If you want to include numbers in the generated id, then you call the Generate method with options indicating your preference.

var options = new GenerationOptions
  UseNumbers = true
string id = ShortId.Generate(options);
// id = O_bBY-YUkJg

If you do not want special characters i.e _ and - in your generated id, then call the Generate method with options indicating your preferences.

var options = new GenerationOptions
  UseSpecialCharacters = false
string id = ShortId.Generate(options);
// id = waBfk3z

If you want to specify the length of the generated id, call the Generate method with options indicating your preferences.

var options = new GenerationOptions
  Length = 9
string id = ShortId.Generate(options);
// id = M-snXzBkj

Customize ShortId

ShortId has several features that help with customizing the ids generated. Characters sets can be introduced and the random number generator can be seeded.

To change the character set in use, run the following:

string characters = "ⒶⒷⒸⒹⒺⒻⒼⒽⒾⒿⓀⓁⓂⓃⓄⓅⓆⓇⓈⓉⓊⓋⓌⓍⓎⓏⓐⓑⓒⓓⓔⓕⓖⓗⓘⓙⓚⓛⓜⓝⓞⓟⓠⓡⓢⓣⓤⓥⓦⓧⓨⓩ①②③④⑤⑥⑦⑧⑨⑩⑪⑫"; //whatever you want;

NOTE: the new character set must not be null, an empty string or whitespace. Also, all whitespace and duplicate characters would be removed, finally the character set cannot be less than 50 characters.

ShortId also allows the seed for the random number generator to be set.

To set the seed, run the following:

int seed = 1939048828;

Finally, ShortId allows for all customizations to be reset using the following:

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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. 
.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.0 is compatible.  netstandard1.1 was computed.  netstandard1.2 was computed.  netstandard1.3 was computed.  netstandard1.4 was computed.  netstandard1.5 was computed.  netstandard1.6 was computed.  netstandard2.0 was computed.  netstandard2.1 was computed. 
.NET Framework net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  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 tizen30 was computed.  tizen40 was computed.  tizen60 was computed. 
Universal Windows Platform uap was computed.  uap10.0 was computed. 
Windows Phone wp8 was computed.  wp81 was computed.  wpa81 was computed. 
Windows Store netcore was computed.  netcore45 was computed.  netcore451 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)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 1.0

    • No dependencies.

NuGet packages (10)

Showing the top 5 NuGet packages that depend on shortid:

Package Downloads

Kotori core library.


Package Description


Development framework accelarator


Package Description


Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
4.0.0 622,976 4/21/2022
3.0.1 704,445 4/11/2021
3.0.0 275,211 8/27/2020
2.0.4 35,538 8/26/2020
2.0.3 63,391 7/4/2020
2.0.2 6,056 6/29/2020
2.0.1 126,168 3/26/2020
2.0.0 429,308 3/9/2018
1.0.4 4,752 2/6/2018
1.0.3 9,884 11/27/2017
1.0.2 6,088 7/5/2017
1.0.1 1,061 6/13/2017
1.0.0 1,186 6/10/2017

- add net5 support