One of the cheapest ways to purchase a phone is by taking it out on contract. This of course means that even when the contract has run out you are still stuck with the same carrier. If you want to take the device over to a different carrier then you will have to unlock it. In the past unlocking a device costs money. But now there is a code going around that will unlock your Samsung handset without it costing a penny.
When you unlock your handset using the code you are free to take it to another carrier. So to begin first get a SIM card that doesn’t belong to the carrier of the phone and follow the steps below.
1. Insert the foreign SIM card into your Samsung Galaxy S5.
2. Turn your handset off and back on again.
3. On the dialpad on your phone, type in *#197328640#.
4. Then select  UMTS >  Debug Screen >  Phone Control >  Network Lock > Options  Perso SHA256 OFF.
5. Wait for 30 seconds or so before returning to your main menu by choosing back.
6. In the main menu, you should see a “Network Lock” message, now choose  NW Lock NV Data INITIALLIZ.
If the code has worked your device should now be unlocked and you can take it over to the carrier of your choice. The code has also been known to work with various handsets belonging to Samsung.