If you purchased your iPhone within the past year or two, it's likely to be unlocked, and free to use with any SIM. However, if your iPhone is older than that, it might be locked to a particular provider. That doesn't mean you're stuck with that provider forever, though.

You should be able to get your network to unlock your iPhone for you - often for free. In fact, you might even be able to unlock your iPhone yourself without ever needing to contact the original provider.

In this article we show you how to unlock all iPhone models, either through an unlock code from the network itself or by using a third-party service. If you're looking to unlock an iPad instead, we have a guide for that too.

Is it legal?

It's completely legal to unlock your iPhone if you have finished paying for your contract or you purchased it outright unsubsidised. However, if you're still in the process of paying for your contract it means you don't fully own the iPhone yet, so you're best to check with your carrier before unlocking it.

If you're not sure whether your iPhone is locked or not, we have a guide to help you find out. The issue usually occurs if you've purchased your iPhone second-hand or inherited one from a friend or family member who has updated to a newer model. If it's locked, you'll find that the iPhone isn't working on your mobile network, and that's because it's tied to a different network.

If you discover that it definitely is locked, read on to find out how to unlock it.

How to unlock an iPhone: iPhone 5s

Contact your network provider

We've separated the article by the UK's most popular carriers to talk you through how to go about getting your iPhone unlocked if it's restricted to that network. Scroll down to your carrier to find out their specific process for unlocking a device.

EE (including Orange and T-Mobile)

If you've had your EE, Orange, or T-Mobile account for at least six months and have paid all of your bills to date, EE will unlock your iPhone for you. It'll cost you £8.99 if you're still within the contract though, and it could take up to seven days, which is not ideal.

If you're a Pay as You Go customer and have enough credit to pay the £8.99 admin fee, EE will unlock your iPhone for you at that price.

However, if you're not an EE customer and you've got an iPhone that's locked to EE, you're going to need to do some digging and if you got it from eBay the chances are it's not going to be easy. You'll need to find out the original owner's name, EE phone number, and maybe some additional account information.

Of course, it's not always going to be possible to find out the information you need, in which case you might need to use a third-party unlocking service as described later in this article.

Vodafone

Similarly, Vodafone requires you to have an account or know the details of the person who did. If those details are already available, you can go straight ahead and use Vodafone's online unlocking form.

It'll take up to 48 hours for the company to get back to you and up to 10 days to unlock it, and it's free to do so.

Three

Three makes things much simpler, you'll be pleased to hear. On its website, the carrier states that any iPhone purchased after 1 January 2014 from Three is automatically unlocked as soon as you connect it to WiFi or connect it to iTunes.

But even if you purchased your iPhone before that, you simply need to connect the iPhone to iTunes and restore the device to unlock it. You'll want to back up your content first, though, as restoring it is going to wipe all of its data.

Alternatively, you can fill out Three's online form.

O2

If your iPhone is locked to O2, you'll be required to fill in an online form to unlock it. If you're a Pay Monthly customer you can unlock your phone at any time, but you'll still be required to finish paying for the rest of your contract.

Pay & Go O2 customers are required to wait for 12 months before they can unlock their iPhone. That's according to O2's website, which also claims that it'll cost £15, but when we spoke to an O2 representative they said they could unlock all O2 iPhones for free.

The same representative also told us that, if you're not an O2 customer, you can simply put a non-O2 SIM card into the iPhone, plug it in to your computer and then open iTunes to unlock the iPhone, but we haven't tested whether this works. 

We would recommend trying this before filling out O2's online form, even if you are an O2 customer, as it could save you a lot of time (it takes up to 72 hours for O2 to unlock it for you).

Virgin Mobile

Virgin says that any iPhone purchased from the company within the past year or so will be unlocked already, but some older iPhones might not have the same luck.

The good news is that all you'll need to do is update your iPhone to iOS 8 or later and it'll be unlocked for you.

If your iPhone isn't compatible with iOS 8 - that is, if it's an iPhone 4 or older - you'll be able to perform a full restore of your iPhone to unlock it. Don't forget to back up your data first, though.

Tesco Mobile

If you've been with Tesco Mobile for 12 months or more, or if you've completed your contract, you'll be able to get an unlock code from Tesco for free by calling 0345 301 4455 and choosing "unlock your mobile."

Giffgaff

Giffgaff has a handy tool that helps you figure out how to unlock your Apple iPhone from its network, which you'll find here.

Using a third-party unlocking service

An alternative to contacting your carrier and asking them to unlock the iPhone is to use a mobile phone unlocking service. There are many retailers in most areas who will arrange an unlock code for a small fee (usually around £25). Although they aren't always reputable, you can also find online services that will unlock your iPhone, but we would advise against it. If you do decide to use one, please make sure that you read all of the small print before you buy, because they can surprise you with extra bills at the end of the process.

We've tried Doctor SIM, which promises to refund you if the unlock is unsuccessful, so that could be an option if you've tried all of the methods listed above. Doctor SIM successfully unlocked our phone with no problems and no hidden fees, so we feel confident in recommending them. 

How much should I pay?

Ideally you shouldn't pay anything to unlock your iPhone, because your carrier should unlock it for you for free. But some carriers are still setting admin charges of up to £20. Third-party companies seem to charge between £10 and £25, and we wouldn't pay more than that. Shop around if anybody quotes you a higher price than that.

How to know if the unlock was successful

Once your phone has been unlocked you will receive a confirmation from the carrier. Now follow these steps:

  1. Power down the phone. Hold down the Sleep/Wake button and move your finger across.
  2. Use the SIM card tool (or a straightened paper clip) to eject the SIM card holder from the side of the phone.
  3. Remove the old SIM card from the SIM card holder. Place your new SIM card into the SIM card holder.
  4. Reinsert the SIM card holder into the iPhone.

How do I update an unlocked phone without the SIM card?

If you've requested an unlock from your carrier, but have not got the original SIM card, you will need to reset the phone before it will be unlocked. First, ensure that you have requested an unlock from the carrier. Now follow these steps

  1. Back up your iPhone. Either using Backup (Settings > iCloud > Storage & Backup > Back Up Now) or by connecting the iPhone to a computer and Using iTunes to perform a backup.
  2. Erase your iPhone. Click on Settings > General > Reset > Erase All Content and Settings.
  3. Complete the setup assistant and restore from your backup.

The phone should now be unlocked.

When you turn the iPhone back on, complete the setup assistant and restore it from the backup you created. Then you can insert the new SIM card and it should now work. So there you have it, your iPhone is unlocked!