Works on this device
Recovery Code Generator
Make a set of random recovery codes, such as the backup codes that let a person into an account when the second sign-in step is lost. Your browser makes them with its secure random generator. This page does not send or save them.
Choose your settings
Check these values
Codes are made in this browser. They are not sent to a server.
Your codes will show here
Choose Generate to make a set.
Made on this device
How it was worked out
How to use the recovery code generator
- Choose the number of codes and the characters in each code.
- Choose the characters to use. Keep Leave out characters that are easy to mix up ticked when people will read and type the codes.
- Choose groups, such as groups of 5 with a hyphen. The separators are not part of the code.
- Choose Generate. Copy the codes, download them as a text file or print them. Choose Generate again for a new set.
How the codes are made
Each character is picked at random from the chosen characters by your browser’s secure random generator (Web Crypto). Every character has the same chance: values that would favour some characters are thrown away and drawn again. If your browser has no secure generator, the tool stops and says so. It never falls back to a weaker one.
Strength of each code = characters in each code × log2(characters to choose from). For example, 10 characters from 31 give 10 × log2(31), about 49.5 bits. The codes of one set are all different: a code that comes out twice is drawn again.
Why there is no seed. Some tools on this site can make the same result again from a seed. That helps with games and tests. Recovery codes are secrets: anyone with the seed could make the same codes. So this tool always uses the secure random generator and never a seed.
Keep the codes safe
- Store the codes offline: print them or write them down, and keep them in a safe place, apart from your password.
- Each code should work only once. Cross out a code when you use it, and make a new set when few are left.
- The codes show on your screen and go to your clipboard when you copy them. Close the page when you are done, above all on a shared computer.
- The service that accepts the codes decides their format, their number and how it checks them. Make the codes in the form it asks for. If you build such a service, store only a hash of each code, not the code itself.
Worked example
The starting settings make 10 codes of 10 small letters and digits, without 0 o 1 i l. That leaves 31 characters to choose from, so each code has 10 × log2(31), about 49.5 bits, and there are about 820 trillion possible codes. In groups of 5 a code looks like k7rmq-4xw2a (a made-up example).
16 characters from Base32 (32 characters, look-alikes kept) give 16 × 5 = 80 bits for each code.
Limits you should know
- The tool does not know the rules of any service, and it does not register the codes anywhere. A service accepts only the codes it made or stored itself.
- The settings must allow at least 1,000 times as many possible codes as codes you make, so that the set has no repeats and is hard to guess.
- Short codes are safe only where the service limits wrong tries.