What an .ics File Contains: Calendar Events as Plain Text
An .ics file is a plain text file in the iCalendar format. It starts with BEGIN:VCALENDAR, ends with END:VCALENDAR, and keeps each event in a BEGIN:VEVENT block in between. If you can read a list of NAME:value lines, you can read a calendar event.
Quick answer
Wikipedia describes iCalendar data files as plain text files, usually with the .ics extension, and gives the media type as text/calendar. Here is a minimal event, based on the example in that article:
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
BEGIN:VEVENT
UID:uid1@example.com
DTSTAMP:19970701T100000Z
DTSTART:19970714T170000Z
DTEND:19970715T040000Z
SUMMARY:Bastille Day Party
END:VEVENT
END:VCALENDARThat's nine lines, with no markup beyond the names themselves. The title, the start and the end that a calendar app shows you all come from lines like these.
How an .ics file is built
The wrapper: VERSION and PRODID
The first line must be BEGIN:VCALENDAR and the last must be END:VCALENDAR. Between them, the body has to include the PRODID and VERSION properties and at least one calendar component. VERSION is 2.0 for the current format. PRODID names the program that wrote the file, so yours will differ from the example above.
One event: the VEVENT
Each event is a VEVENT block. According to RFC 5545, UID and DTSTAMP are required, DTSTART is the inclusive start and DTEND the non-inclusive end. SUMMARY, DESCRIPTION and LOCATION are optional.
UIDis the event's identity. Wikipedia notes that a later event distributed with the same UID replaces the original, and that a UUID is now recommended over an email-style ID.DTSTAMPis when the record was created.SUMMARYis the title you see in your calendar.
Lines, parameters and folding
Every line follows one shape: a name, optional ;PARAM=value parameters, a colon, then the value. A line with a parameter looks like this:
ATTENDEE;RSVP=TRUE;ROLE=REQ-PARTICIPANT:mailto:jsmith@example.comLines end with a CRLF pair, and the default character set is UTF-8. RFC 5545 says lines should not be longer than 75 octets, and that a long line can be split by inserting a line break followed by a single space or tab. The RFC's own example:
DESCRIPTION:This is a lo
ng description
that exists on a long line.To read it, delete each line break and the one space that follows it. The result is This is a long description that exists on a long line. Wikipedia adds that an actual line feed inside a value is written as a backslash and the letter n.
Dates: UTC, floating and TZID
A timestamp looks like 19970714T170000Z: year, month, day, T, then hour, minute and second. There are three ways to say where in the world that is:
DTSTART:19970714T170000Z
DTSTART:19970714T170000
DTSTART;TZID=America/New_York:19980119T020000The first ends in Z, which means UTC. The second has no suffix and is "floating", not bound to any time zone. The third names a zone with the TZID parameter. RFC 5545 says TZID must not be applied to times already given in UTC.
Recurrence and alarms
A repeating event adds an RRULE, where the FREQ part is required, as in FREQ=DAILY;COUNT=10;INTERVAL=2. A reminder is a VALARM block nested inside the event; it must include ACTION and TRIGGER, such as TRIGGER:-PT30M for 30 minutes before. Those two are where hand-editing gets risky, so slow down there.
When to use it (and when to skip it)
Editing the file by hand pays off when you need to fix a typo in a title, shift a time, check what an invite really says, or generate events from a script. And because it's text, a diff shows exactly what changed.
The same format travels by email. RFC 6047 says a message part carrying it must use the text/calendar content type with a method parameter, and a charset of UTF-8 when the content has non-ASCII characters:
Content-Type: text/calendar; method=REQUEST; charset=UTF-8Skip hand-writing when the event involves custom time zone rules or complicated recurrence. Folding is easy to break, too. A stray space or a missing line break can make a calendar app reject the file. Strict text formats come with this kind of care, and you'll see it in CSV quoting rules from RFC 4180, in JSON Lines and in security.txt.
How Carets fits in
Because an .ics file is text, a text editor can open it, and Carets is a fast, native notes and code editor for iPhone, iPad and Mac. Plain text is a first-class format there, so you can open the file, change a SUMMARY or a DTSTART, and save it as plain text, with the original line structure left alone. Files, projects and tags let you keep a folder of events or invite templates together, and the code-style editing suits a format where every character in a line counts.
We built Carets for this kind of job: a quick edit to a text file without a heavy tool. On a phone, that matters. Your files stay plain text, portable and readable years from now.
Get Carets on the App Store for iPhone, iPad and Mac.
Frequently Asked Questions
Is an .ics file really just text?
Yes. Wikipedia describes iCalendar data files as plain text files with the .ics extension, and the media type is text/calendar. Any text editor can open one.
Why do some lines start with a space?
That is line folding. RFC 5545 says lines should not exceed 75 octets, and a long line can be split with a line break followed by a single space or tab. Join the lines back by removing the break and that one leading space.
What does the Z at the end of a time mean?
Z marks UTC. A time without it is either floating, meaning not tied to a zone, or it carries a TZID parameter that names one.
What happens if I import the same event twice?
Events carry a UID. Wikipedia notes that a later event distributed with the same UID replaces the original, although how an app treats an import is up to the app.