Skip to main content

How to create QR codes for vCards

A vCard (or Virtual Contact File) is a specially formatted text that is used to transfer contacts between phones. Because it's just text, it's possible to create a QR code that can be scanned as a contact.

Nearly all phones can export contacts as vCards, which makes them a useful format for sending contact information. QR codes are a universal format that allow users to easily import this information on their phone.

Phone screenshot scanning a vCard QR code

In the example above, we used a spreadsheet generate vCards that can be imported as QR codes:

How it works

Under the hood, vCards are just text. Here's an example vCard:

BEGIN:VCARD
VERSION:3.0
N:Lastname;Firstname
FN:Firstname Lastname
ORG:CompanyName
TITLE:JobTitle
ADR:;;123 Sesame St;SomeCity;CA;12345;USA
TEL;WORK;VOICE:1234567890
TEL;CELL:Mobile
TEL;FAX:
EMAIL;WORK;INTERNET:[email protected]
URL:http://website.com
END:VCARD

If you encode the above into QR code text, you can use the QR code API to get the following:

This QR code contains a vCard
This QR code contains a vCard

This can be done by taking the base URL, https://quickchart.io/qr?text=, and then adding a URL-encoded vCard:

https://quickchart.io/qr?text=BEGIN%3AVCARD%0AVERSION%3A3.0%0AN%3ALastname%3BFirstname%0AN%3AFirstname%20Lastname%0AORG%3ACompanyName%0ATITLE%3AJobTitle%0AADR%3A%3B%3B123%20Sesame%20St%3BSomeCity%3BCA%3B12345%3BUSA%0ATEL%3BWORK%3BVOICE%3A1234567890%0ATEL%3BCELL%3AMobile%0ATEL%3BFAX%3A%0AEMAIL%3BWORK%3BINTERNET%3Afoo%40email.com%0AURL%3Ahttp%3A%2F%2Fwebsite.com%0AEND%3AVCARD

To learn more about the API, check out the documentation.

For more information on customizing the vCard, the vCard Wikipedia article contains a useful reference table that summarizes potential vCard properties for your use.

Automatically generating the vCard and QR code

We can go one step further. Here's an example spreadsheet that shows how you can generate scannable vCard QR codes based on your data.

First, we use a formula to fill in the vCard column based on the First name, Last name, Company, Cell, and Email columns:

="BEGIN:VCARD
VERSION:3.0
N:" & A2 & " " & B2 &"
ORG:" & C2 & "
TEL:" & D2 & "
EMAIL:" & E2 &"
END:VCARD"""

Then, we use the ENCODEURL function to encode the vCard value to get a working URL:

="https://quickchart.io/qr?text=" & ENCODEURL(F2)

The resulting URL is valid and can be downloaded or embedded anywhere.

Finally, use the IMAGE function to render the QR code:

=IMAGE(G2)
Spreadsheet with vCard QR codes

Encoding special characters

If you're using special characters e.g. from a language other than English, you may need to specify the encoding of your vCard values. Here's an example that uses UTF-8 encoding to ensure that the vCard is correctly read on all mobile platforms:

BEGIN:VCARD
VERSION:3.0
N;CHARSET=UTF-8:Doe;John;;;
FN;CHARSET=UTF-8:John Doe
ORG;CHARSET=UTF-8:Example Company
EMAIL;CHARSET=UTF-8;type=INTERNET,WORK:[email protected]
END:VCARD

Need help?

That's all there is to it! To further customize your QR code, refer to the documentation.

For questions, head to the community forum.


Ian Webster

About the author

Ian Webster is a software engineer and former Googler based in San Mateo, California. He has helped Google, NASA, and governments around the world improve their data pipelines and visualizations. In 2018, Ian created QuickChart, a collection of open-source APIs that support data visualization efforts.

Email · LinkedIn · Twitter