If you have the Samsung Galaxy S3, S2 or S4 and it is locked, you may be able to unlock it for free with easy to follow steps. When the device is unlocked you can then use it with any carrier, if you are not locked into a contract.
It you bought that handset with AT&T in the US then at the moment you can only use your handset with that carrier. Should you unlock it though, you would be able to use it with any carrier. You may even send it overseas to a friend or relative. So here are the steps for you to unlock your phone.
Put a SIM card into the device that is not yours and then switch it off and on again.
Open up the dialpad and key in *#197328640#. Go to Main Menu >  UMTS >  Debug Screen >  Phone Control >  Network Lock > Options Perso SHA256 OFF > then wait for 30 seconds or so. Then hit Menus and choose Back. You should now see Network Lock. Then choose  NW Lock NV Data INITIALLIZ.
To make sure you didn’t make a mistake, the sequence you should have typed in is: Asterisk Pound One Nine Seven Three Two Eight Six Four Zero Pound. However some people call the asterisk the star button and the pound button is sometimes called hash.
The device should now be unlocked to use with any carrier. This is a code that Samsung have been using for some time, so it could work with virtually any handset in the Samsung range.