← All guides

What Makes a Password Strong: Length, Randomness, and Entropy

Every password rule you have ever met—the capital letter, the digit, the symbol—is a rough attempt at one thing: making the password hard to guess. There is a cleaner way to think about it. A password's strength can be measured in bits of entropy. That measurement shows that the rules most sites enforce miss the point. Length and randomness do the real work. This guide shows the math with real numbers. You can judge any password, or any password policy, yourself.

Strength is measured in bits

Entropy counts how many tries a password could possibly take to guess, written as a power of two. Each character in a password adds bits. How many it adds depends on the size of the set it was drawn from. A character picked from the 26 lowercase letters adds about 4.7 bits. One picked from all 94 printable characters on a keyboard adds about 6.55 bits. Multiply by the number of characters. You have the strength of the whole password, assuming every character was picked at random.

That assumption is the heart of the matter, and we will return to it. First, the counting itself. A random 8-character password from the full keyboard set carries about 52.4 bits. A random 12-character password from the same set carries about 78.7 bits. A random 12-character password using only lowercase letters carries about 56.4 bits, more than the short full-set one. And 16 characters drawn from just lowercase letters and digits, 36 symbols, carry about 82.7 bits. Length adds bits steadily and predictably. The character set adds them too, but each extra character is worth more than each widening of the set.

What the bits mean in time

Bits become real when you price them in guesses. Take a strong attacker: a stolen password database, fast hardware, ten billion guesses a second. Against that attacker, trying every possible 8-character full-set password takes about 169 hours, roughly a week. On average half the space falls in half that time. An 8-character password, however clever its mix of symbols, is a week's work at best. This is why short passwords fail even when they follow every rule.

Now price the 12-character password at 78.7 bits. The full space is about 4.76 times ten to the twenty-third combinations. At ten billion guesses a second, trying them all takes about 1.5 million years. The average break takes about half that. No rule about symbols produced that gap. Four extra characters did. Real attacks are usually slower than this example. Sites that store passwords properly make each guess expensive. Stretches every number further. But the ranking never changes: length is the lever that moves the answer by orders of magnitude.

Passphrases: length you can remember

The honest problem with a random 16-character password is that nobody can remember twenty of them. The passphrase is the answer built for humans. Take five words picked at random from a large word list of 7,776 words, the size used by the well-known dice method. Each word adds about 12.9 bits. Five words carry about 64.6 bits, stronger than the 8-character full-set password. Most people can hold five plain words in memory after a little use.

Two things make a passphrase honest. The words have to be picked at random, by dice or by a generator, not by you. The phrases people choose are the ones attackers try first. The password also has to be unique to its account. Strength does nothing against reuse. A strong password pasted into a breached site is a strong password handed over. A password manager holds the long random ones. Your memory only has to hold the few that unlock the manager itself.

Random beats clever

Human-made passwords follow human habits: a name, a year, a keyboard walk, a word with the vowels swapped for digits and a symbol at the end. Attackers know these habits and try them first, in order, before any honest counting begins. A password that looks complex to a person, like a word with 0 for o and a ! at the end, is among the first patterns a cracking program tests. Its true entropy is far below what the character count suggests, because it was not picked at random from the set. It was picked from a much smaller set: the set of things people do.

This generator does not have habits. It picks each character on its own, from the full set you allow, using the Web Crypto API in your browser. That is the same source of randomness your browser trusts for secure connections. That is why the tools on this site matter for this job in particular: the password is created on your device, shown to you. Never sent anywhere. Generate it, save it in a manager. The counting in the first section of this guide actually describes your password.

Why sites store hashes, and what that means for you

A careful site never stores your password itself. It stores a hash: a fixed-length fingerprint computed from the password, which cannot be run backward. The SHA-256 hash of the word hello is 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824. 64 characters of hex for any input, short or long. When you sign in, the site hashes what you typed and compares fingerprints. When a database leaks, what leaks is the fingerprints, and the attacker must guess passwords and hash each guess to compare, which is exactly the guessing game priced above.

This is why your password's strength is partly your own defense, even against failures that are not yours. A short password in a leaked database falls in days. A long random one outlasts the hardware thrown at it. You cannot control how every site stores its data. You can control the two things that decide your side of the math: make it long, make it random, and never use it twice.

Try it yourself

Put the math to work with the free Password Generator on CodeToolWorks: set the length, pick the character sets, and generate on your own device. The Random String Generator builds tokens. Keys the same way. The Hash Generator shows the SHA-256, SHA-512. SHA-1 fingerprint of any text you enter.