Bitcoin Core Wallet information is stored in a file called wallet.dat that holds the digital ownership of your BTC. wallet.dat is not encrypted by default, as soon as someone gains access to your computer, they will be able to spend your coins instantly.
Bitcoin Core developers enabled a feature called Encrypt Wallet inside the latest Bitcoin Core client for you to encrypt wallet by protecting it with passphrase. This will make it impossible for anyone to send bitcoins from your wallet without entering passphrase, even if an attacker were to gain access to the device.
Step 1: Open Bitcoin-Qt.
Step 2: Go to Settings > Encrypt Wallet.
Step 3: Set a very strong and difficult-to-crack passphrase, preferably a password that contains numbers, uppercase and lowercase letters and symbols such as @ or # with at least 12 characters long as a minimum.
Step 4: Click OK to save the passphrase. You have to enter this passphrase manually every time if you want to transfer Bitcoin out of your wallet.
Step 5: Warning dialog box show to explain that you will lose all of the bitcoins contained within that wallet if you forget your passphrase. Click Yes to confirm.
Step 6: Notification window show that in order for encryption process to complete, Bitcoin-Qt will have to close and any previous backups of your wallet file (wallet.dat) will need to be replaced with a new backup. Click OK to let the program close.
Step 7: To change the passphrase, go to Settings > Change Passphrase and follow the prompts.
Alternatively, you can use an external tool to encrypt wallet.dat file, most of which are completely free of charge to use.
For Bitcoin wallet installed on mobile device, most of the mobile applications stored wallet.dat file on device itself and protect it with PIN code.
It is a good idea to make a note of passphrase. If you lose or forgot your password, your bitcoins will be unspendable forever.
Medium: Thoughts on Secure Storage of Bitcoins and Other Crypto Backed Assets
Bitcoin Wiki: Securing your wallet