Sometimes a single phone number isn’t enough — if you need to go abroad, for example, or need separate business and personal numbers, two is definitely better than one. Until recently, unless your phone could accommodate two SIMs, you were out of luck. However, Apple has now made it possible for owners of an iPhone XR, iPhone XS, or iPhone XS Max to add a second line of service by using an eSIM (or digital SIM), bypassing the need for a physical SIM card.

This will let you easily add a local carrier if you travel internationally. You can even have two different plans on the same phone — say, one for voice and messages and one for data. Three major vendors currently offer eSIM capabilities: AT&T, Verizon and T-Mobile.

If you want to add an eSIM to your iPhone, and are either a customer of one of those three carriers (or are willing to become one), here’s how to do it.

A few things to keep in mind before you start. First, this is not a free service — you’re purchasing a second line, with all the expenses that go with it. Your phone also needs to be running iOS 12.1.1 or later. And if you want to have plans from two different carriers, your phone must be unlocked. Otherwise, both your SIMs will have to be from the same carrier.

First, you will need to purchase a new eSIM account via the AT&T website, You’re going to need your device’s IMEI number (the unique number that identifies your specific phone). To locate it, tap on Settings, then General, and then About.

Once you’ve purchased the eSIM plan, you’ll want to set up your phone for dual SIMs.

Go to Settings, Cellular, and Add Cellular Plan. Scan the QR code from your carrier with your phone. Then look at the bottom of your screen, and tap Enter Details Manually. Select Add Cellular Plan and you’ll see both your previous plan and the new plan; you can label them as you wish (“Personal” and “Work,” for example). Hit Done, and on the next screen choose which line you want to be your default.

Although you can have two active phone numbers, you can only use one data plan at a time

Note that while both phone numbers can be active at the same time (so you can be on a call with one and get a call from the other), you can only use one data plan at a time. If you want to switch to the data plan you’re using, go to your Cellular menu, choose Cellular Data and then select Cellular Data Switching.

And if you use FirstNet, AT&T’s service for first responders, be aware that, according to AT&T, the second SIM may interfere with the first SIM’s connectivity.

If you’re using Verizon, you can perform the entire process from the My Verizon app. Open the app and tap Join Now and then Get Started.

The next stage in the process is to locate and register your IMEI by going to Settings, then General, and then About. Scroll to the Digital SIM IMEI, and copy it by tapping and holding.

You’ve got the number; now you have to go back to your My Verizon app, tap the field that reads Digital SIM IMEI Number, paste in the IMEI by tapping and holding, and then hit Check eligibility. (Note: Pre-pay plans will not work with the eSIM.)

Assuming you’re eligible, you’ll then get a series of screens that will lead you through the process of activating your new service, including selecting a phone number (if you’re coming from another service, you can port over your existing number), creating a PIN, and — oh, yes — entering your billing information. Once that’s done, you’ll get an email with a QR code. On your iPhone, go to Settings, Cellular, and Add Cellular Plan, and then scan the QR code from the email so you can do the final account setup.

Phew! Done. Congratulations, you now have two phone numbers (and two data plans) on the same iPhone.

T-Mobile currently only supports eSIM on its prepaid plans, although the company says it will support postpaid plans in the future. Existing T-Mobile customers who want to add a second line to an existing phone are advised to use T-Mobile’s DIGITS plan, which lets you access up to five lines from one device.

To get going, you download the T-Mobile eSIM app from the App Store (assuming you don’t have it already) and choose T-Mobile eSIM from the home screen. Enter your email (if your email address is already being used for an existing T-Mobile plan, you’ll need a different address). Tap on Next and either confirm or enter your zip code. Choose Done, Next, and confirm your address. After that, you’ll be asked to choose a prepaid option, let T-Mobile know you accept the service plan, enter your payment information, choose a PIN, and label your new account.

At this point, you may get a notice saying that you’re choosing an uncertified cellular plan. Don’t sweat it; just hit OK and go on to the next screen, which will let you choose your default plan. And that’s it.

Update December 17th, 1:46PM ET: We updated this article to add information on T-Mobile’s eSIM plans.