Whether you're dusting off an old MacBook to give your kids for online classes or you just set up a new work laptop to work from home, forgetting the password to your Mac can be a frustrating experience. Each failed login attempt can cause confusion and even panic. Don't worry, though. Apple knows that a forgotten password situation is a personal hell that many of us run into, which is why the MacOS software includes built-in features for this exact situation.

There are a few different tools you can use, and the road you take to unlock your Mac without a password could depend on whether or not you linked your Apple ID to your user account on your Mac during setup.

If you didn't, that's OK, there's still another option to reset your account password. Here's how to get started regaining control over your Mac computer.

Use your Apple ID to reset your password

Ideally, you'll have linked your Apple ID to your user account on your Mac during the initial setup, which will make it possible to reset your user password with just a few clicks.

Jason Cipriani/CNET

After entering the wrong user password three times, you'll be asked if you want to reset the password using your Apple ID, if it's linked to your account. If you don't see the message after your third attempt, your account isn't linked to your Apple ID and you'll need to use the method outlined below.

Here's what to do:

Enter your Apple ID email address and password, and follow the rest of the prompts to create a new password. When you change the password, you'll see a prompt letting you know a new login keychain -- what MacOS uses to store your passwords will be created, but your old keychain will remain saved on your Mac. If you ever remember your old password, you'll be able to unlock the old keychain.

Now playing: Watch this: MacOS Catalina: 5 best things

Use an Admin account

If you share your Mac with friends or family members and they forgot their password, odds are you'll be able to reset it for them. The key here is that you need access to an Admin user account.

Usually, the person who first set up the Mac has an admin account by default, but you can check by logging in to your account and opening System Preferences > Users & Groups and viewing the list of user accounts on your Mac. Just below the user name will be the account type -- if it says "Admin" you can reset user passwords.

To do so, from that same Users & Groups screen, click on the lock and enter your admin name and password when prompted. Next, select the user you need to reset the password for and then click on the button labeled Reset Password and follow the instructions.

Jason Cipriani/CNET

Use Recovery Mode to reset your password

You'll need to boot your Mac into Recovery Mode in order to access the password reset tool. I've found the easiest way to do that is to turn off your Mac.

With your Mac turned off, press and hold the Command and R keys on your keyboard, then press the power button. Hold in Command+R until you see a progress bar show up below the Apple logo. You can also get into Recovery Mode by restarting your Mac and trying to time the keyboard combo of Command+R, but in my experience, starting with your Mac turned off is the most reliable method.

With your Mac now in Recovery Mode, click on Utilities in the menu bar followed by Terminal. A new window will show up, waiting for you to enter a command. Type "resetpassword" as one word, without the quotes, and press Return.

Close the Terminal window, where you will then find the Reset Password tool. A list of all user accounts on your Mac will be on display. To reset the password for your account, you'll need to set a new password for all users. Make sure you write down the new password for anyone who shares your Mac.

Sarah Tew/CNET

If FileVault is enabled on your Mac

FileVault is an optional MacOS feature that encrypts your Mac's hard drive and all of the data stored on it. You can turn it on during initial setup, or in System Preferences at a later time.

If you have FileVault turned on, you have two additional options to reset your user password. You can wait up to a minute on the user login screen for a prompt to show up that instructs you to press the power button to restart the Mac into Recovery mode. Follow the instructions to restart your computer, after which you should see a Reset Password window show up.

The other option is to use the Recovery Key that you should have written down when you enabled FileVault. Let's be honest, most of us don't do that, but if you did you can enter the recovery key when asked after three failed login attempts. Be sure to use upper case letters and to enter the hyphens -- they're required.

Any method we outlined is an effective way of regaining access to your account, or if your child forgot their password. Of course, if you can use this to get into your Mac, so can someone else who has access to your computer. You can prevent that from happening, you'll just need to be more proactive during setup with storing recovery keys and remembering your password. Here's how to lock down your Mac.