Skip to content

NanoID & Random String Generator

Generates NanoIDs and random strings of any length, from letters, numbers or your own characters, with a uniqueness estimate.

Your IDs stay on this device

This tool runs entirely inside your web browser. Your IDs are processed on your own device and are never sent to our servers. How this works

Short random IDs with the length and characters you choose.

64 possible characters, 126 bits of randomness. At 1,000 IDs per hour, it would take about 149 billion years to reach a 1% chance of a duplicate.

Your ID

NanoID & Random String Generator is a free tool for creating short, random, unique IDs. Choose the length and the characters to use (letters, numbers, hex, a set without look-alike characters, or your own) and generate one or up to 1,000 at a time. It shows how safe your settings are from duplicates. IDs are created in your browser with secure randomness.

How to generate IDs

  1. Set the length. NanoID’s default is 21 characters.
  2. Pick the characters, or choose Custom and type your own.
  3. Set how many you need and click Copy all or Download.

Common settings

Understanding the uniqueness estimate

Random IDs can in theory repeat. How likely that is depends on the number of possible IDs (the character count raised to the power of the length) and how many you create. The estimate uses the “birthday problem” maths to show how long it would take, generating 1,000 IDs every hour, before there is a 1% chance that any two of them are identical. The default NanoID settings give 126 bits of randomness, so the answer is billions of years. A 6-digit number is only safe for a handful of IDs.

NanoID, UUID or ObjectId?

NanoID is shorter than a UUID and fully customisable, which suits URLs and user-facing codes. UUIDs are the standard for databases and systems that expect that format, and UUID v7 sorts by time. MongoDB uses ObjectIds by default. Generate any of them with the UUID Generator or theObjectId Generator. For passwords people have to remember or type once, use the Password Generator.

Frequently asked questions

What is NanoID?

A popular way to create short, random, URL-friendly IDs. By default it uses 21 characters from A–Z, a–z, 0–9, “-” and “_”, which is about as hard to guess or collide as a UUID v4 while being 15 characters shorter.

How long should my ID be?

It depends on how many IDs you will create. The estimate under the settings shows how long it would take, at 1,000 IDs per hour, to reach a 1% chance that any two IDs are the same. Choose a length that gives a comfortable margin; if the estimate turns orange, make the ID longer.

Can I use only numbers or only letters?

Yes. Choose “Numbers only”, “Letters only” or another set, or pick Custom and type exactly the characters you want. With fewer different characters, you need a longer ID for the same uniqueness.

What does “No look-alikes” do?

It leaves out characters people confuse when reading or typing, such as 0 and O, or 1, l and I. It is useful for codes people type by hand, such as vouchers or order references.

Are these IDs secure?

Yes. Every character is picked with your browser’s cryptographically secure random number generator, with no bias towards any character, so they are suitable for tokens and invitation links. Nothing is sent to a server.

Will the IDs match what the nanoid npm package produces?

They have the same format and randomness, so they can be used interchangeably. To generate them in code, use nanoid() for the default, or customAlphabet(alphabet, size) for a custom set.

Last updated

Missing a feature, or need a tool we don’t have? Suggest it.