There might be more than one reason why people would want to unlock their smartphone but to do so, you will need to get the unlock code from the carrier. Luckily, the unlock code for the Samsung Galaxy S4 was leaked so unlocking it is no longer an issue now. Here is how you can unlock the device on your own.
Start by putting in a new SIM card. Next, restart the Samsung Galaxy S4 and open up the dial pad. Enter the code, *#197328640 and select UMTS >  Debug Screen >  Phone Control >  Network Lock > Options  Perso SHA256 OFF.
Wait for at least 30 seconds before pressing Back to enter Main Menu once more. Now select  NW Lock NV Data INITIALLIZ. Your Samsung Galaxy S4 should be unlocked now. It is also said that the code also works on some of the older models like the Samsung Galaxy S3.