Product Features Why TransitLens Guides

How to Read GTFS Data

GTFS (General Transit Feed Specification) is the most widely used standard for sharing public transit schedules and geographic information. If you're working with transit data for the first time, this guide walks you through the structure of a GTFS feed and how to make sense of it.

What is GTFS?

GTFS stands for General Transit Feed Specification. Originally developed by Google and TriMet (Portland's transit agency) in 2005, it has become the global standard for describing public transportation schedules, routes, and stops.

A GTFS feed is a collection of plain-text CSV files bundled into a single ZIP archive. Each file describes a different aspect of the transit system — from what routes exist, to where stops are located, to when services run.

Transit agencies around the world publish GTFS feeds to share their data with trip planners, researchers, and applications like Google Maps. There are over 2,500 publicly available GTFS feeds worldwide.

GTFS Static vs. GTFS Realtime

There are two flavors of GTFS:

This guide focuses on GTFS Static, which is the foundation that GTFS Realtime builds upon.

Key files in a GTFS feed

A GTFS feed can contain up to 17+ files, but most feeds rely on a core set. Here are the most important ones:

FileRequiredDescription
agency.txtYesTransit agency name, URL, timezone, and contact info
routes.txtYesTransit routes (bus lines, subway lines, etc.)
trips.txtYesIndividual trips along each route
stops.txtYesPhysical stop locations with coordinates
stop_times.txtYesArrival/departure times at each stop for each trip
calendar.txtConditionalRegular weekly service patterns (Mon–Sun)
calendar_dates.txtConditionalExceptions to regular service (holidays, special days)
shapes.txtNoGeographic path that a vehicle follows along a route
frequencies.txtNoHeadway-based service instead of exact times
transfers.txtNoRules for transferring between routes at stops

The required files form the skeleton of any GTFS feed. Without them, a consumer application cannot understand the transit network. The conditional and optional files add richer detail.

How the files connect

GTFS files are relational — they reference each other through ID fields. The core relationship chain is:

agency.txt routes.txt trips.txt stop_times.txt stops.txt
calendar.txt / calendar_dates.txt

An agency operates routes. Each route has many trips (individual journeys). Each trip visits a sequence of stops at specific times defined in stop_times. The calendar files define which days each trip's service runs.

Routes, trips, and stops explained

The distinction between routes, trips, and stops is the key to understanding GTFS. Think of it this way:

Example: reading routes.txt

Here's what a typical routes.txt file looks like:

route_id,agency_id,route_short_name,route_long_name,route_type
R1,agency1,38,Geary,3
R2,agency1,N,Judah,0
R3,agency1,BART-R,Red Line,1

The route_type field tells you what kind of vehicle operates the route: 0 = tram, 1 = subway, 2 = rail, 3 = bus, 4 = ferry, and so on.

Example: reading stop_times.txt

This is typically the largest file in a GTFS feed. Each row is one stop visit on one trip:

trip_id,arrival_time,departure_time,stop_id,stop_sequence
T1001,07:15:00,07:15:00,S100,1
T1001,07:18:00,07:18:00,S101,2
T1001,07:22:00,07:22:00,S102,3

Trip T1001 visits stop S100 first (at 7:15 AM), then S101, then S102. The stop_sequence field ensures the correct ordering even if arrival times are the same.

How to visualize GTFS data

Raw GTFS data is just text files with IDs and coordinates. While you can open them in a spreadsheet, visualizing the data on a map and calendar reveals patterns that are impossible to spot in tabular form:

Visualization transforms GTFS from an abstract dataset into something you can understand intuitively — which is why transit planners, researchers, and analysts rely on visual tools when working with feeds.

Using tools like TransitLens

TransitLens is a browser-based GTFS explorer that lets you upload any GTFS feed and immediately see it on an interactive map. You can:

If you're new to GTFS, loading a feed into a visual tool is the fastest way to build intuition about how the data is structured. You'll see the relationships between routes, trips, and stops come to life on the map.

Ready to try it? Open TransitLens and load a GTFS feed to start exploring. You can also open a feed directly from a URL — try loading the MBTA Boston feed to see a real transit network instantly.

For more about how TransitLens works as a complete GTFS exploration tool — including map views, data tables, and calendar analysis — see the GTFS Viewer page. For spatial analysis and map-first workflows, see the GTFS Map Viewer.

See GTFS data in action

Upload any GTFS feed and instantly visualize routes, stops, and service patterns on an interactive map.

Open TransitLens