There are two ways to do this. The easiest way is to use the third party app Coconut Battery which shows this information and works for both Intel and Apple Silicon Macs.
For Intel Macs only, you can also calculate the value by finding the Design Capacity of the battery by using the command line. Run the following command to find the Design Capacity:
sudo pmset -g rawlog
This command will prompt you for your admin password. Nothing will appear on the screen as you type the password. Press the "Return" key to submit the password. This command will keep updating the battery & power information about once a minute, so you will need to press Control + C to terminate this command.
Now you can calculate the percentage by taking the Full Charge Capacity (FCC) value and dividing it by the Design Capacity value.
I believe Apple Silicon Macs already show this percentage value, but I forget exactly where it is. I do know the information returned by the command is different for Apple Silicon Macs, but the Coconut Battery app still shows the information.