If you have a newer OS version with iCloud you have the option to use iCloud Keychain, which will keep all of your passwords in sync across all your Apple devices. All you have to do is turn it on in the iCloud menu of Settings on the old Mac and then sign in with your Apple ID on the new Mac and it should ask you to activate iCloud Keychain on the new Mac. You just verify and you're done!