Random ID and String Generator
Pick a kind of identifier, how many you need and how long. The page tells you how many bits of randomness you get and how many values you can make before a repeat becomes likely.
Worked examples
The time part of a ULID
Time 0, 32 milliseconds and the largest value
0000000000 0000000010 7ZZZZZZZZZ
Each digit is a base 32 place, so 32 milliseconds is 10 and the largest time is 7ZZZZZZZZZ.
Strength of a short ID
21 characters from 64
126 bits
Each of 64 characters carries 6 bits.
About Random ID and String Generator
Almost every system needs identifiers: keys for database rows, tokens for links, names for uploaded files, codes for vouchers. A good identifier is unique, hard to guess if it must be, and in some cases sortable. Different formats trade these properties differently, and it helps to see how much randomness you are getting.
This generator makes ULIDs, which begin with a millisecond timestamp so they sort by creation time, short URL-friendly IDs from 64 characters or from an alphabet you supply, and random strings from sets of letters, digits and symbols, hex or Base64. Characters are chosen with equal probability from the platform random number generator. For each batch the page shows the bits of randomness and roughly how many values you could make before a repeat has a 1 per cent chance.
How to use Random ID and String Generator
- Choose the kind of value and how many you want.
- For IDs and strings, set the length and the characters. For a ULID you can set the time.
- Press Generate again for a new batch.
- Copy the list, and check the bits and repeat estimate under the box.
Common uses
- Creating test data keys and tokens
- Choosing an ID length that is long enough for your expected volume
- Making readable codes without look-alike characters
- Finding the creation time hidden inside a ULID
Frequently asked questions
What is a ULID?
A 26 character identifier that holds a 48 bit time in milliseconds followed by 80 random bits, written in an alphabet without I, L, O or U. Because the time comes first, a list of ULIDs sorts in the order they were made.
How long should a random ID be?
It depends on how many you will create. The page shows how many values you can make before a repeat has a 1 per cent chance. A 21 character ID from 64 characters has 126 bits, which is a very large margin.
Are the values random enough for secrets?
They come from the platform cryptographic random number generator and each character has an equal chance, so they suit tokens and keys. For passwords with rules, use the password generator.
Why leave out look-alike characters?
Characters such as 0 and O or 1, l and I are easy to misread. Leaving them out helps when people have to read or type a code, at the cost of a little randomness.
Can I decode a ULID?
Yes. Choose the decode option and paste one or more ULIDs to see the date and time they were created. The remaining part is random.