What is GTFS?

GTFS (the General Transit Feed Specification) is the standard, open format that transit agencies use to publish their schedules and route information so that trip planners, mapping apps, and researchers can consume them. If you've ever gotten transit directions in Google Maps, Apple Maps, Transit, Citymapper, or Moovit, those apps were reading GTFS feeds.

The short version

A GTFS feed is just a ZIP file containing a handful of CSV-style text files. Each file describes one part of a transit system: agencies, routes, stops, the schedule of trips, the calendar of service days, and so on. Together they describe everything an outside app needs to plan a trip on your service.

The format was originally developed by Google and Portland's TriMet in 2005 (it was first called "Google Transit Feed Specification") and has since become the de facto open standard, maintained by the MobilityData non-profit and a community of agency and vendor contributors.

What's in a GTFS feed?

A minimal feed contains these files (all CSV with a .txt extension):

FileWhat it describes
agency.txtThe transit agency operating the service.
routes.txtEach named route, such as the "1 Main St", the "Red Line", or the "Crosstown Express".
stops.txtEvery stop or station, with latitude and longitude.
trips.txtEach individual run of a route on a given service day.
stop_times.txtThe arrival and departure time of each trip at each stop.
calendar.txtWhich days of the week each service pattern runs.

Optional but commonly included:

shapes.txtThe actual geometry of each route: the polyline drawn on the map.
calendar_dates.txtHoliday exceptions and special service dates.
fare_attributes.txt & fare_rules.txtHow much it costs to ride.
frequencies.txtHeadway-based service ("every 10 minutes from 6am to 9pm").
transfers.txtSpecial transfer rules between stops.
feed_info.txtMetadata about the feed itself: publisher, version, date range.

Who consumes GTFS?

GTFS Schedule vs. GTFS Realtime

"GTFS" by itself usually means GTFS Schedule (the static, planned schedule). There's a separate companion specification, GTFS Realtime, that publishes live data: actual vehicle positions, trip updates (delays, cancellations), and service alerts. Realtime feeds reference the static feed by ID, so you need a clean, accurate schedule feed before realtime makes sense. GTFS·X is focused on the schedule side.

What about demand-responsive transit?

The base GTFS spec assumes fixed routes and fixed schedules. For microtransit, dial-a-ride, and other demand-responsive service, there's an extension called GTFS-Flex that adds polygon service zones, pickup/drop-off windows, and booking rules. See What is GTFS-Flex? for the details.

How do I publish a feed?

Three steps:

  1. Build the feed: describe your routes, stops, trips, and schedule in the GTFS format. You can do this by hand in a spreadsheet, with scripts, or with an editor like GTFS·X.
  2. Validate it: run the feed through the canonical GTFS validator to catch errors before consumers do. GTFS·X validates as you go.
  3. Host it at a stable URL: put the ZIP file at a permanent URL on your agency's website and submit it to consumers. The Mobility Database is the canonical registry; once you're listed there, most major trip planners will pick up your feed automatically.

Where to go from here

See also