Step 1: Click on the Apple Menu and select System Preferences.
Step 2: Select Security & Privacy
Step 3: Click on the FileVault tab at the top and select "Turn On FileVault".
Note: If you are unable to click anything, you may need click on the padlock on the bottom-left. If it says "Turn Off FileVault" then you are already encrypted and will not need to do anything further.
Step 4: You will be prompted to select one of the options as shown below.
The safest option is to select "Allow my iCloud account to unlock my disk".
Step 5: Your Mac will now generate a Recovery Key. Make a copy and save this in a
safe place. This is the only time the Recovery Key will be displayed.
If you forget your password and if you do not have the Recovery Key, all of the data on your disk will be lost.
Step 6: Click on Restart to begin the encryption process. You can use your computer during the encryption process.
Please refer to the following link if you are on macOS Ventura or later.