Toggle light / dark theme

vCard, Explained by Building One

TL;DR

A vCard (.vcf) is a plain-text contact file your phone can import straight into its address book. It is thirty years old, it has three versions in the wild, and generating one correctly comes down to three rules: CRLF line endings, fold lines over 75 octets, and escape the separators — but not the structural ones. I ship version 3.0, because it is still the most compatible, and mine has no phone number in it, by design. If you want to play with the format hands-on, I built a vCard workbench that parses, validates, and generates them entirely in your browser.

A format from 1995 that still runs your contacts

vCard started with the Versit Consortium — Apple, AT&T, IBM, and Siemens — in 1995, moved to the IETF in 1996, and has had three versions since. All three are still out there, which is the first thing that makes the format confusing:

Version Year Spec Where you meet it
2.1 1996 Versit Legacy enterprise systems, Android contact exports, Bluetooth phonebook
3.0 1998 RFC 2426 Apple Contacts and iCloud exports; the safest choice today
4.0 2011 RFC 6350 The current standard; stricter, UTF-8 throughout, URI-based values

A vCard is a block of lines between BEGIN:VCARD and END:VCARD. Every line is NAME[;PARAMETERS]:VALUE, and the two lines you cannot skip are VERSION and FN, the formatted display name. Everything else is optional, which is why two cards for the same person can look nothing alike.

The card my site serves

My portfolio has a Save contact button in the sidebar. It opens a modal, and the download inside it is generated from exactly these lines — the same list feeds the route, the modal preview, and the per-field toggles, so they can never drift apart:

BEGIN:VCARD
VERSION:3.0
FN:Justin P. Lyons
N:Lyons;Justin;P.;;
TITLE:IT Manager | Automation Engineer | Full-Stack Developer
EMAIL;TYPE=INTERNET:justinplyons@gmail.com
URL:https://justinlyons.dev
URL;TYPE=GitHub:https://github.com/enonymous1
URL;TYPE=LinkedIn:https://linkedin.com/in/justinplyons
ADR;TYPE=HOME:;;Fredericksburg;VA;;;United States
END:VCARD

Two details in there are deliberate. N is the structured name — family, given, additional, prefix, suffix — and the empty fields still get their semicolons. ADR works the same way: PO box, extended address, street, city, region, postcode, country, with the blanks kept as empty segments. And the address is city-level on purpose: Fredericksburg, VA, not a street address.

Why 3.0 and not 4.0

4.0 is the current standard, and it is the cleaner spec — UTF-8 mandated, no more inline encodings, phone numbers as tel: URIs. But 3.0 is what Apple Contacts still exports, and it is what every client I tested against accepts without complaint. The differences that matter in practice:

Area 3.0 (RFC 2426) 4.0 (RFC 6350)
PHOTO PHOTO;ENCODING=b;TYPE=JPEG:<base64> PHOTO;MEDIATYPE=image/jpeg:<base64> or a plain URI
BDAY Compact YYYYMMDD ISO YYYY-MM-DD, partial dates allowed
TEL Plain text number Prefers tel: URI form
Extra properties — KIND, GENDER, ANNIVERSARY, and more

If you are generating a card for the widest possible audience — iOS, Android, desktop clients at once — 3.0 is still the safe pick, and that is what I ship. The workbench I built lets you flip between the two and warns you when a 4.0-only property sneaks under a 3.0 header, which is the mistake I would have made first.

Three rules that bite when you generate one

Line endings are CRLF. The spec says \r\n, not \n. Most parsers tolerate a bare \n, but "most" is doing a lot of work in that sentence when the file is going into someone's address book, so my generator joins every line with CRLF and the download goes out as text/vcard.

Lines fold at 75 octets. A line longer than 75 bytes gets wrapped by inserting a CRLF followed by a single space, and parsers unfold by stripping that sequence. My card's longest line is 61 octets (the TITLE line), so my site generator never has to fold — I measured it rather than assuming it. The workbench's serializer does fold, because a real contact with a long note or a base64 photo will blow past 75 octets fast.

Escape the separators — but not the structural ones. Inside a text value, commas, semicolons, backslashes, and literal newlines get backslash-escaped. But the semicolons in N and ADR are structure, not text: escaping them turns five name components into one garbled string on the importing phone. That was a real bug in the workbench's first version — the serializer escaped the separators too — and it is exactly the kind of bug that only shows up when you import the file somewhere real instead of staring at it.

The field I left out

There is no phone number in my card, and the modal says why: a downloadable file publishes a number just as much as the page would. The toggles let you drop any field before downloading — job title, email, website, GitHub, LinkedIn, location — but the name is always included and the phone number was never an option. That is a privacy call, not a technical limit, and it is the one decision in the whole feature that I would not change for compatibility.

The modal itself is the honest version of the feature. The toggles rebuild the preview live as you check and uncheck them, and the download is built client-side from that preview text — a Blob, not another server round trip. The plain /justin-lyons.vcf route is still there as the no-JavaScript fallback, serving the full card.

Going deeper: the workbench

The site feature taught me the happy path. The vCard workbench is where I went to learn the rest of it: a client-side parser, validator, and generator with a visual builder, a raw .vcf editor, a batch table for multi-contact files, and a QR code you can scan straight into a phone. Everything runs in the browser — no network calls, no trackers, no data leaving the page — and the QR holds roughly 3 KB of text at the error-correction level it uses, so it warns you instead of silently truncating when a contact gets too big.

The part I keep coming back to is the Version History tab: the same contact rendered as vCard 2.1, 3.0, and 4.0, with the differing lines highlighted. The 2.1 version uses bare parameters like TEL;WORK;VOICE and quoted-printable encoding, 3.0 moves to TYPE= parameters, and 4.0 switches to tel: URIs and adds KIND:individual. Seeing the same person three ways is the fastest way to understand what each version actually changed — and why 3.0 is still the one to ship.

Is anything replacing it?

Two things are worth knowing, and the rest is trivia.

JSContact is the real successor. RFC 9553 (May 2024) redesigns the contact model from scratch as idiomatic JSON — native localization, strict typing — instead of wrapping vCard's line syntax in brackets, and it pairs with JMAP for modern address-book syncing. For APIs, this is the future. For a file you hand to a phone, it is not there yet: no contacts app imports a .json the way it imports a .vcf.

MECARD is the compact alternative. NTT DoCoMo's format strips the headers and parameters down to a single short string, roughly half the characters of the equivalent vCard, which makes a physically simpler QR code — and iOS and Android cameras still parse it natively. It cannot carry everything a vCard can, so it is a QR shortcut, not a replacement.

The rest are mappings or dead ends. jCard (RFC 7095) and xCard (RFC 6351) are JSON and XML renderings of vCard 4.0 that survive in niches — RDAP responses, XMPP — and Portable Contacts and FOAF tried to replace downloadable address books with linkable web profiles in the Web 2.0 era and lost. For a file a phone imports, nothing has displaced vCard. That is why the site ships 3.0.

Source for the history and the spec details: the vCard workbench itself, and the RFCs it implements — RFC 2426 for 3.0 and RFC 6350 for 4.0, plus RFC 9553 for JSContact.

vcardweb