Nowadays, users cannot simply interchange sim cards anymore, usually, the phone needs to be tied-in to a specific network. For example, Samsung smartphones are often tied to a particular carrier or network, so you can’t migrate to another carrier without unlocking the device. You can’t just insert a “foreign” SIM card and make some calls, you need to perform a bit of trickery first.
If you want to take your Samsung Galaxy S5 to another network, you can unlock it quite easily and, more importantly, free of charge. This means that you will be able to use your handset on other networks, at home or abroad. You will need to provide a SIM card from the new network, though.
Once you’ve got your SIM, follow these steps:
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.
Now your device should be unlocked and able to move to any carrier you fancy, or maybe you can send it abroad to a friend or relative. This code has been used by Samsung engineers for a while so it will probably work on most Samsung devices like the Galaxy S5 and the Note 3.