also read
7zip how to password protect
first, download and install the latest 7zip for windows here
download and install latest 7zip for mac here
Now, select the file you want to compress. Then right-click the selected file and choose 7-Zip
click Add to archive
Make sure to choose 7-zip for the archive format. Then enter your password under encryption section
then confirm the password and click ok