Short, URL-safe, cryptographically random identifiers.
Pick a length and an alphabet. The default is 21 characters drawn from 64 URL-safe characters.
21 characters from a 63-character alphabet is 126 bits of entropy.
You would need about 1.1 × 10^18 IDs before the chance of any two matching reaches 1%.
From the maker of MakeUUID
Short random strings, sized to the job.
A NanoID is nothing more than a run of characters picked uniformly at random from an alphabet you choose, using the same cryptographic random source a UUID uses. There are no version bits, no variant field and no standard to satisfy, so the only decisions are how long the ID is and which characters it may contain.
The default alphabet is the URL-safe set: A to Z, a to z, the ten digits and the hyphen. Every one of those characters survives a URL, a query string, a filename and a double-click without escaping, which is the entire reason the set looks the way it does. Each character is worth close to six bits, so the default 21 of them carry about 126 bits of entropy, a little more than the 122 random bits in a UUID v4 and in fifteen fewer characters.
Shortening the ID is the interesting trade-off. Each character you drop divides the space by the size of the alphabet, and the number of IDs you can safely mint falls with the square root of that space. Twelve characters is plenty for a few million short links; eight is not. Size it against the volume you actually expect, and watch the readout above rather than guessing.