Wi-Fi passwords saved on your Mac are stored in an application called Keychain Access. So you can easily retrieve them if you don’t remember.
If you enable iCloud Keychain on your iPhone/iPad, you can also use Keychain Access on your Mac to find the Wi-Fi passwords saved on these devices as well.
How to show your Wi-Fi password on macOS
Step 1: Open Keychain Access on your Mac. The quickest way is to press Command + Space bar, then type “Keychain Access” into Spotlight Search. Or you can find it in Finder → Application → Utilities.
Step 2: Click “Passwords” under the “Category” section in the sidebar. Type the Wi-Fi network’s name into the search box in the top-right corner of the window.
Step 3: Once find it, double click on the network. Click on “Show Password”. You will be prompted to enter your administrator name and password twice.
Step 4: After you confirm your administrator name and password, you should be able to see the Wi-Fi password in the text box next to the “Show Password” option.
Not only does Keychain Access store Wi-Fi passwords, but it also stores passwords used in your applications and web forms. So if you forget these pieces of information, you can use Keychain Access to find them as well.
Keychain on iOS devices
iPhone, iPad and iPod touch users cannot view Wi-Fi passwords on these devices. But if you have a Mac computer & iCloud Keychain enabled on your iOS device, you can use Keychain Access on your Mac to get back the Wi-Fi passwords saved on the iPhone/iPad as well.
iCloud Keychain will encrypt your information and sync to iCloud so your passwords are accessible from your Mac. Just repeat the above steps and you will find it.
About iCloud Keychain & how to find saved Wi-Fi passwords on iPhone and iPad, please refer to this article.