Generate a QR code image for your Wi-Fi in Shortcuts on iOS or iPadOS

Written on October 10, 2020

Since iOS 11, iPhone users have had the ability to share their Wi-Fi passwords with folks in their Contacts. I remember the first time I discovered this, it felt like magic!

But occasionally I’ve had a person over who isn’t in my Contacts or perhaps they are on a non-Apple device. I don’t feel comfortable with reading out my Wi-Fi password, so I would politely ask for their device and manually add the credentials for them to use my Wi-Fi—nothing magical about this.

While not as magical of wirelessly granting access, you can however allow people to join your Wi-Fi network using a QR code.

Using Shortcuts on iOS or iPadOS, you can generate a QR code which you can then allow other mobile users to scan and get access to your Wi-Fi.

What’s the Shortcut do?

Before diving into the steps of building the Shortcut, here is a quick overview of what it will do when it is run.

It’ll first ask you which encryption method your network is using. Either WEP (Wired Equivalent Privacy) or WPA (Wireless Protected Access). These two options are provided to you as a list to select one.

List prompt in Shortcuts providing options for WPA and WEP

Then it asks you for your network’s name by providing a prompt to enter your answer.

Shortcuts prompt asking for network name

Finally it asks for the password for your network by again providing a prompt to enter you answer.

Shortcuts prompt asking for network password

Once you provide the password, the Shortcut generates an image with the QR code which contains the information for others to join your network.

Shortcuts generated Wi-Fi QR code

How to set it up in Shortcuts

The entire shortcut is made up of ten actions and this is what it looks like,

Shortcut show all the actions for the QR code generator

Stepping through each action of the shortcut

  1. The first action is a List action. Which is where we add two options, one for WEP and the other is WPA. The reason why we create this list is so that in the next step, it asks you to make a choice about the encryption type used for the network.

  2. Taking the list of network encryption types from the first action, in the second action we use a Choose from List action. This will prompt you when you run this shortcut of to choose from the encryption type list.

  3. In the next action I use a Set Variable to take the choice made from the second action and assign it to a variable called AuthType. This will be used later in the shortcut when generating the QR code.

  4. The forth action is a Ask for Input. This is so that I can ask the question, “What is your network name?” and the text input received from the prompt could then be assigned to a variable in the next action.

  5. This action is another Set Variable action which assigns a variable named NetworkName with the input from the fourth action.

  6. I then ask, “What is your network password?”, which again is triggered by using another Ask for Input action. The input from this action gets passed onto another variable.

  7. This Set Variable action is named Password and again is used to build the QR code in the next action.

  8. In this action, we’re using the Text action. This is because in order to generate a QR code that allows your friends and family to scan with their phone, we need to generate the QR code using a text formatted like this:


    When putting this text together, in place where I’ve put brackets and a variable name, you’ll replace the brackets and variable with the Shortcuts variable.

  9. In this action, we will use a Generate QR Code action. This action will take the newly created text from the last action and output a QR code.

  10. In this final action, I used the Show Result action. This is so that it’ll immediately show me the results of the newly generated Wi-Fi QR code.

With your newly created QR code, you can take a screenshot and save it to Photos to share it with friends and family that may need access to your network. Or print it out and place it in an easily accessible place for you to point to the next time someone asks, “Hey can I hop on your Wi-Fi?”.

Stay in touch

Thanks for reading this article. I'd love to stay in touch and share more tips on programming and side projects with you. Sign up and I'll send you my articles straight to your email, you'll also get a free copy of the light themed version of my Git cheat sheet.
Git cheat sheet preview image