is an independent website that is supported by advertising. may be compensated by credit card issuers whose offers appear on the site. Because we are paid by our advertising partners it may impact placement of products on the site, including the order in which they appear. Not all available credit card issuers or card offers are included on the site.

Find Better Flights on ITA Matrix with Advanced Routing Language

icon-comments Comments

The best feature of ITA Matrix is the advanced routing language that can be used to specify a traveler’s exact needs. Many other airlines and online travel agencies use the same technology as ITA Matrix precisely because of powerful abilities like this.

However, most other websites provide filters that clean up search results after the fact, and excluding bad results won’t always improve those that remain. Search algorithms tend to run for a short time before they terminate present the user with any results found up to that point. When there are many paths to a destination, providing advance instructions will make it easier for ITA Matrix to perform an exhaustive search of the results you care about.

In addition, ITA Matrix searches a wide variety of carriers without regard for alliances or partnerships. It can examine the possibility of cheaper fares if you route your payment through a different country. It also has access to lots of filters most other websites don’t have, like the ability to search for specific flight numbers. All of these make it a more comprehensive and less biased search tool.

Exclude Airlines or Airports

The basics of advanced routing language were already explained in the introduction to ITA Matrix. These included functions like choosing a specific airline or a specific connecting airport. I also showed how to list multiple airlines or airports and indicate a specific number of flights.

This time, instead of telling ITA Matrix what to look for, I can tell it what I’m not interested in. Negation is performed using the tilde symbol (~).

Example 1: ~AA ~DFW AA (one flight not marketed by AA and a connection anywhere except DFW, then a flight marketed by AA to the final destination)

To include or exclude multiple airlines or airports, use a comma.

Example 2: AA,UA ~DFW,ORD (one flight marketed by AA or UA to any airport except DFW or ORD, then a flight on any airline to the final destination)

Specify an Operating Carrier or Flight Number

In all previous examples, I have referred to flights “marketed” by an airline. Many airlines have codeshare agreements that allow one airline to market (sell) the flights operated by a second airline. If a ticket has a flight number preceded by “AA” then it is marketed by American Airlines even though British Airways may be flying the plane. The “operating” carrier will have a different flight number for the tickets sold to its customers.

The distinction between marketing and operating carrier matters. Sometimes changing the marketing airline will result in a different price, or it might affect rules for upgrades and earning frequent flyer miles.

By default ITA Matrix will search by marketing airline. You can choose to search by operating airline instead — but this doesn’t completely eliminate the problem of codeshares. It just means if you do have a codeshare, the roles of marketing and operating carrier will be reversed.

Example 3: AA (one flight marketed by AA, but could be operated by any airline)
Example 4: O:AA (one flight operated by AA, but could be marketed by any airline)

Another useful command is to specify the exact flight number. Like a preference for operating carrier, it is rarely used but can be very important in some cases. You may already know that you want to travel on a specific flight across the Atlantic Ocean, but you don’t care about the connecting flights on either end.

Example 5: UA15 (the itinerary must include travel on flight 15 marketed by UA)

Here’s a summary of the most common advanced routing language commands, including those discussed in the introductory post:

AA Direct flight marketed by a specific carrier (It could be operated by a codeshare partner)
AA+One or more flights on a specific carrier
AA, UADirect flight on one of the carriers separated by a comma
O:AADirect flight operated by a specific carrier (It could be marketed by a codeshare partner)
O:AA, O:UADirect flight operated by one of the carriers separated by commas
NAny nonstop flight. This contrasts with a direct flight, which may have a connection but still uses he same flight number
N:AAAny nonstop flight marketed by AA
SFOA connection at a specified airport. You can also use city codes (e.g., NYC)
DFW, STLA connection at one of the airports separated by commas
XAny single connection. Repeat and separate with spaces to dofine multiple connections
X?Zero flights or no flight. This will permit a connection but leaves open the possibility of a nonstop itinery
MSPDirect flight or one connection point at the specified airport
UA15A specific flight number, in this case United Airlines flight 15
AA 1000-2000A single flight on AA within the range of 1000-2000
-Negation. Use this to exclude an airline, airport, or flight. For example, use - DEN to allow a flight that connects anywhere but Denver

ITA Matrix also provides its own examples and instructions. They’re not very detailed, which is why this article was written. I still recommend you review it before continuing to the more unusual examples of routing language in the second half.

ITA routing language 1
ITA routing language 2
ITA routing language 3
ITA routing language 4

Specify an Airline Alliance

In addition to the standard routing language used above, there are special sets of rules that are preceded by a forward slash. These special rules may be all you need if you don’t care much about the airline you fly or connecting cities. However, when both sets of routing language are used, the special commands must be placed at the very end.

A common example is to specify an airline alliance (instead of specifying an individual airline). Remember that some airlines have other partners that are not included in a formal alliance relationship.

Example 6: /alliance star-alliance
Example 7: /alliance oneworld
Example 8: /alliance skyteam

Specify a Booking Class

Another common use of these special rules is to request a specific booking class. These are the individual letters that airlines use to control their inventory. They may also be relevant to the upgrade rules for a ticket and, in some cases, how many frequent flyer miles can be earned. A request for the Y booking class, which usually represents full-priced refundable tickets in economy class, would look like this:

Example 9: /f bc=y

You may not need the most expensive fare, but there are cases where paying a little more offers more benefits. To provide a practical example, United Airlines will let members upgrade international flights with a Global Premier Upgrade. An ordinary search might find cheaper fares in the L or K class, but someone who wants to upgrade their ticket would need to buy a more expensive W fare. To search for United Airlines flights with a W booking class, you would use this routing language:

Example 10: UA+ /f bc=w

The plus symbol indicates a request for one or more flights with an United Airlines flight number, and the rest asks that the ticket be issued in the W booking class. Requesting a single airline with the plus symbol is one of the most common uses of advanced routing language.

To look for more than one booking class at a time, separate each one with a vertical pipe (located above the return or enter key). Sometimes the W booking class is sold out or not available, so it can be helpful to search for the V booking class, as well.

Example 11: /f bc=w|bc=v

Other Special Commands

There are more special commands that use the forward slash, as well as examples of combining advanced routing language in creative ways to force particular itineraries.

- overnightNo overnight stops
- changeNo airport changes (e.g., from Heathrow to Gatwick)
- redeyeNo redeye flights
- propNo flights operated with propeller planes
-trainNo trains
- helicopterNo helicopters
minconnect XXMinimum connection time of XX minutes
maxconnect XX Maximum connection time of XX minutes
padconnect XXRequire XX minutes in addition to the airlines's minimum recommendation
maxdur XXXMaximum total trip duration of XXX minutes

When using the booking class and alliance commands, no other special commands that require a forward slash can be added. However, the special commands in the above table can be combined together using a comma.

Example 12: / -overnight,-redeye

Other special commands can be used to exclude long or short connections. Some connections are unavoidable; the real problem is when that stop involves five hours sitting in a terminal with nothing to do.

Example 13: / maxconnect 120

Many of these commands will require practice before you understand the best ways to use them. Always remember that routing language is optional; if your query doesn’t work, cut back on the number of commands you use until you identify the problem.

The final installment in this series will explain how to use advanced routing language to save money using certain tricks, like hidden city ticketing, that are easier to discover with ITA Matrix than with a traditional airline website.

Editorial Disclosure: Opinions expressed here are author's alone, not those of any bank, credit card issuer, hotel, airline, or other entity. This content has not been reviewed, approved or otherwise endorsed by any of the entities included within the post.

UGC Disclosure: The responses below are not provided or commissioned by the bank advertiser. Responses have not been reviewed, approved, or otherwise endorsed by the bank advertiser. It is not the bank advertiser's responsibility to ensure all posts and/or questions are answered.