How can I generate a random password in Excel?

Generating a random password in Excel involves using a combination of built-in functions such as RAND and RANDBETWEEN to create a series of random characters. This can be done by specifying the length and type of characters (numbers, letters, symbols) that the password should contain. The resulting password can then be copied and used for various purposes such as securing sensitive information or accessing online accounts. By utilizing the randomness of these functions, Excel provides a simple and efficient way to generate strong and unique passwords.

Generate a Random Password in Excel (With Example)


You can use the following formula to generate an 8-character random password in Excel:

=CHAR(RANDBETWEEN(65,90))&RANDBETWEEN(0,9)&CHAR(RANDBETWEEN(97,122))&CHAR(RANDBETWEEN(97,122))&CHAR(RANDBETWEEN(65,90))&RANDBETWEEN(0,9)&CHAR(RANDBETWEEN(65,90))&RANDBETWEEN(0,9)

Here is how this formula works:

  • CHAR(RANDBETWEEN(65,90)) generates a random uppercase letter
  • RANDBETWEEN(0,9) generates a random number between 0 and 9
  • CHAR(RANDBETWEEN(97,122)) generates a random lowercase letter

We then use the & symbol to concatenate each of these random values together into one string.

The following example shows how to use this formula to generate a random password in Excel in practice.

Example: Generate Random Password in Excel

We will type the following formula into cell A2 in Excel to generate a random 8-character password that contains uppercase letters, lowercase letters, and numbers:

=CHAR(RANDBETWEEN(65,90))&RANDBETWEEN(0,9)&CHAR(RANDBETWEEN(97,122))&CHAR(RANDBETWEEN(97,122))&CHAR(RANDBETWEEN(65,90))&RANDBETWEEN(0,9)&CHAR(RANDBETWEEN(65,90))&RANDBETWEEN(0,9)

The following screenshot shows how to use this formula in practice:

Excel generate random password

The formula generates the random password of U0sjA1L2.

If we double click on cell A2 and press Enter, we can generate a brand new random password:

This time the formula generates the random password of J3hkR1J4.

Note that you can use any combination of the following formulas to generate a password with a different specific length:

  • CHAR(RANDBETWEEN(65,90)) to generate a random uppercase letter
  • RANDBETWEEN(0,9) to generate a random number between 0 and 9
  • CHAR(RANDBETWEEN(97,122)) to generate a random lowercase letter
=CHAR(RANDBETWEEN(65,90))&RANDBETWEEN(0,9)&CHAR(RANDBETWEEN(97,122))

The following screenshot shows how to use this formula in practice:

This time the formula generates the random password of H5k.

Feel free to use any combination of these functions that you’d like to generate a random password with a specific length.

Additional Resources

The following tutorials explain how to perform other common operations in Excel:

x