When you take on a smartphone it can be tied to a carrier, which means that you can’t take it over to a different carrier when your contract has run out. If you want to do this then you have to unlock your handset first.
There is a code going around that will allow you to unlock your device free of charge, which then allows you to take your phone and use it with a different carrier. So get a SIM card that is not your own and then check out 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 all has gone well your handset will now be unlocked and you can move it to the carrier of your choice. You could even send the device overseas to relatives or friends. The code could work with many different Samsung devices so try it.