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 your wallet by protecting it with a passphrase. This will make it impossible for anyone to send bitcoins from your wallet without entering a passphrase, even if an attacker were to gain access to the device.
- Open Bitcoin-Qt.
- Go to Settings > Encrypt Wallet.
- 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.
- 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.
- The warning dialog box show to explains that you will lose all of the bitcoins contained within that wallet if you forget your passphrase. Click Yes to confirm.
- The notification window shows that in order for the 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.
- 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 a mobile device, most of the mobile applications stored wallet.dat file on the device itself and protect it with a PIN code.
Important Note
It is a good idea to make a note of the passphrase. If you lose or forgot your password, your bitcoins will be unspendable forever.