Predefined character sets to use with nanoid. Used by nanoid-generate.
Install nanoid and dictionary
npm i nanoid nanoid-dictionary
Require a customAlphabet from nanoid and pass a string from the dictionary:
import { customAlphabet } from 'nanoid';
import { lowercase } from 'nanoid-dictionary';
const lowercaseRandomString = customAlphabet(lowercase, 10);
numbersNumbers from 0 to 9
import { numbers } from 'nanoid-dictionary';
hexadecimalLowercaseLowercase English hexadecimal lowercase characters: 0123456789abcdef
import { hexadecimalLowercase } from 'nanoid-dictionary';
hexadecimalUppercaseUppercase English hexadecimal uppercase characters: 0123456789ABCDEF
import { hexadecimalUppercase } from 'nanoid-dictionary';
lowercaseLowercase English letters: abcdefghijklmnopqrstuvwxyz
import { lowercase } from 'nanoid-dictionary';
uppercaseUppercase English letters: ABCDEFGHIJKLMNOPQRSTUVWXYZ
import { uppercase } from 'nanoid-dictionary';
alphanumericCombination of all the lowercase, uppercase characters and numbers from 0 to 9
Does not include any symbols or special characters
import { alphanumeric } from 'nanoid-dictionary';
nolookalikesNumbers and english alphabet without lookalikes: 1, l, I, 0, O, o, u, v, 5, S, s, 2, Z.
Complete set: 346789ABCDEFGHJKLMNPQRTUVWXYabcdefghijkmnpqrtwxyz
import { nolookalikes } from 'nanoid-dictionary';
nolookalikesSafeSame as nolookalikes but with removed vowels and following letters: 3, 4, x, X, V.
This list should protect you from accidentally getting obscene words in generated strings.
Complete set: 6789BCDFGHJKLMNPQRTWbcdfghjkmnpqrtwz
import { nolookalikesSafe } from 'nanoid-dictionary';
cookieSafeAll the allowed characters for a cookie value defined in RFC6225.
import { cookieSafe } from 'nanoid-dictionary';
cookieUnsafeAll the characters that actually work in modern browsers. Might not be suitable for servers, use with caution.
import { cookieUnsafe } from 'nanoid-dictionary';
448 followers · starred Oct 2023
447 followers · starred Jan 2025
JavaScript
100.0%
Predefined character sets to use with nanoid. Used by nanoid-generate.
Install nanoid and dictionary
npm i nanoid nanoid-dictionary
Require a customAlphabet from nanoid and pass a string from the dictionary:
import { customAlphabet } from 'nanoid';
import { lowercase } from 'nanoid-dictionary';
const lowercaseRandomString = customAlphabet(lowercase, 10);
numbersNumbers from 0 to 9
import { numbers } from 'nanoid-dictionary';
hexadecimalLowercaseLowercase English hexadecimal lowercase characters: 0123456789abcdef
import { hexadecimalLowercase } from 'nanoid-dictionary';
hexadecimalUppercaseUppercase English hexadecimal uppercase characters: 0123456789ABCDEF
import { hexadecimalUppercase } from 'nanoid-dictionary';
lowercaseLowercase English letters: abcdefghijklmnopqrstuvwxyz
import { lowercase } from 'nanoid-dictionary';
uppercaseUppercase English letters: ABCDEFGHIJKLMNOPQRSTUVWXYZ
import { uppercase } from 'nanoid-dictionary';
alphanumericCombination of all the lowercase, uppercase characters and numbers from 0 to 9
Does not include any symbols or special characters
import { alphanumeric } from 'nanoid-dictionary';
nolookalikesNumbers and english alphabet without lookalikes: 1, l, I, 0, O, o, u, v, 5, S, s, 2, Z.
Complete set: 346789ABCDEFGHJKLMNPQRTUVWXYabcdefghijkmnpqrtwxyz
import { nolookalikes } from 'nanoid-dictionary';
nolookalikesSafeSame as nolookalikes but with removed vowels and following letters: 3, 4, x, X, V.
This list should protect you from accidentally getting obscene words in generated strings.
Complete set: 6789BCDFGHJKLMNPQRTWbcdfghjkmnpqrtwz
import { nolookalikesSafe } from 'nanoid-dictionary';
cookieSafeAll the allowed characters for a cookie value defined in RFC6225.
import { cookieSafe } from 'nanoid-dictionary';
cookieUnsafeAll the characters that actually work in modern browsers. Might not be suitable for servers, use with caution.
import { cookieUnsafe } from 'nanoid-dictionary';
448 followers · starred Oct 2023
447 followers · starred Jan 2025
JavaScript
100.0%