Search for Flights Like a Travel Agent Using ITA Matrix Routing Language (2024)

If you’re new, then you’ll want to start by reading my introduction to ITA Matrix— what I consider one of the best free tools to search for air travel. It doesn’t let you book tickets but does provide very detailed information and a lot of control on the parameters of your search. These parameters are important because most search engines time out and provide only partial results. If you want to make sure you’ve really exhausted your search for the best flight, you need to know that you also excluded everything irrelevant.

The key to defining your search query is with advanced routing language. ITA Matrix was eventually purchased by Google and forms the basis of the popular Google Flights tool. Several features have also been copied by Hipmunk. While advanced routing language is still most powerful when used with ITA Matrix, a good understanding will help you improve your flight search on these other websites.

Recap on Using ITA Matrix

Last time I introduced how to use ITA Matrix for a basic round trip flight. Among other things I showed you how to use time bars to display flight options and how to view the fare breakdown of the final itinerary. In my next post I’ll talk about a lot of special features and filters that maximize the value of using ITA Matrix to perform your search.

Today I’m going to focus on routing language, which is the core feature of ITA Matrix. This can be used to limit your search results to force certain airlines, certain flight numbers, and certain connections. ITA Matrix shares some of this information on its website (and the number of commands listed is much more thorough in version 3.0), but it does not always show how to combine these commands into more powerful queries.


Review: Fairmont Maldives Grounds, Amenities and Dining

Where to EnterAdvanced Routing Language

So, how do we activate this magical feature? Some of the routing language is simply rules about the way you enter specific airport and airline names within the departure and destination fields. Commas let you enter more than one option.

After the basic language for departure/destination airports, you can use more commands for things like connections, fare class, and connection time. In the original version of ITA Matrix you would have started with your airport, then separate the routing codes with two colons (” :: “). After the colons you would enter the routing codes for things like connecting cities or specific airlines. Then, you can enter a forward slash (” / “) with extension codes after that.

Here’s a query that asks for an outbound flight from Seattle with one or more segments on United Airlines. It should include a connection in Denver or Chicago in the W or V fare class.

Departing from > SEA :: UA+ DEN,ORD /f bc=w|bc=v

Search for Flights Like a Travel Agent Using ITA Matrix Routing Language (2)

However, we’re now in version 3 of ITA Matrix. If you try to do this today, ITA will automatically switch to the new view and move your text into separate fields for all this routing language. Notice that the colons and slashes have been removed.

Departing from > SEA
Outbound routing codes > UA+ DEN,ORD
Outbound extension codes > f bc=w|bc=v

Search for Flights Like a Travel Agent Using ITA Matrix Routing Language (3)

To reduce confusion, I don’t see any point in telling you how to write a command that ITA is going to change anyway. (But I want you to know how to interpret what you might read elsewhere.) I am going to dispense with the colons and simply tell you what to enter in every box. You can force these extra fields to appear by clicking on “Advanced controls.”

Search Specific Airlines and Connecting Airports

The simplest commands are to specify your airline and connecting airport. We’ll use the example of a flight from Seattle (SEA) to Washington-Dulles (IAD) in all examples unless otherwise stated.

Imagine you want to fly on United Airlines. Instead of searching for a flight from SEA to IAD, you should enter the following:

Departing from > SEA
Outbound routing codes > UA
Outbound extension codes >

Destination > IAD
Return routing codes >
Return extension codes >

This instructs ITA Matrix to look for a (single) flight from Seattle on United Airlines. In the results below you can see these are the only options provided by ITA Matrix.

Search for Flights Like a Travel Agent Using ITA Matrix Routing Language (4)

Clearly, you will need to become familiar with three-letter airport codes and two-letter airline codes to become proficient at creating such queries. It’s easy enough to look them up with Google (e.g., search for “united airlines code”).

However, we’ve only provided instruction on the outbound journey. ITA Matrix will switch the fields around automatically to find our return flight, looking for a return journey from our “Destination” to our “Departing from.” But it will rely on return routing codes and return extension codes to filter results, and there are no instructions for the trip from IAD to SEA.

It could return anything. That’s one of the beauties of ITA Matrix: you not only have the power to filter your results with precise detail, but you also have the power to set different rules for each direction of travel. If you want to fly United Airlines on the return journey, you’ll need to specify that again (you can also pick a different airline, as there’s no need for it to be the same one).

Departing from > SEA
Outbound routing codes > UA
Outbound extension codes >

Destination > IAD
Return routing codes > UA
Return extension codes >

United Airlines offers both nonstop and connecting itineraries on this route. Complimentary upgrades are usually easier to get on connecting flights, but imagine it is winter and we don’t want to go through Chicago or Denver. You can force a connection in Houston by entering that airport’s code after the airline code. (I’ll explain another way of excluding options if you keep reading.)

Again, you’ll need to enter it in both fields if you want that instruction to apply to the outbound and the return journey.

Departing from > SEA
Outbound routing codes > UA IAH
Outbound extension codes >

Destination > IAD
Return routing codes > UA IAH
Return extension codes >

And you can see that in the search results, all of the options have a United Airlines flight with a stop in Houston.

Search for Flights Like a Travel Agent Using ITA Matrix Routing Language (5)

Technically, we have only told ITA Matrix that we want one flight from Seattle to Houston on United Airlines followed by any possible flight to Washington-Dulles. The instructions end at “IAH” so ITA Matrix is not constrained in how it gets you to the final destination. Usually you’ll still be on the same airline. But if you want to be really specific you should still enter the airline’s code again.

Departing from > SEA
Outbound routing codes > UA IAH UA
Outbound extension codes >

Destination > IAD
Return routing codes > UA IAH UA
Return extension codes >

By now you should be getting the picture. An alternating pattern of airport, airline, airport, airline of instructions is required. Skipping entries in this pattern is fine, but when instructions are not provided, ITA Matrix can do what it likes. You could just as easily let it pick from any airline to reach Houston, but still require United Airlines between Houston and Washington-Dulles.

Departing from > SEA
Outbound routing codes > IAH UA
Outbound extension codes >

Destination > IAD
Return routing codes > UA IAH UA
Return extension codes >

Search Multiple Airlines and Airports at Once

Having addressed the basic mechanics of routing codes, it’s now easy to combine them or make them more complex. For example, you can leave out the airlines altogether if you only want to specify the connecting airports. Or you can leave out the connecting airports and only specify the airlines. If you want to give ITA Matrix a choice, separate those entries by commas.

Departing from > SEA
Outbound routing codes > SFO,LAX,IAH
Outbound extension codes >

Destination > IAD
Return routing codes > UA,AA,DL
Return extension codes >

In the above example, it is implied that we will have two flights on the outbound journey because we must make a connection at one of three airports. It’s also implied that there will be a single flight on the return journey because we have specified one flight on any of three different airlines.

Typically I do not care about connection points but do care about how many flights I take. Use the plus (“+”) symbol to indicate one or more flights by an airline, or enter the airline’s code multiple times to indicate a specific number of flights.

Departing from > SEA
Outbound routing codes > UA+
Outbound extension codes >

Destination > IAD
Return routing codes > UA UA UA+
Return extension codes >

The above example permits any number of flights (one or more) on United Airlines from Seattle to Washington-Dulles. The return journey requires three or more flights on United Airlines, because there must be one flight, then another, then one or more. The plus symbol is extremely important because usually you don’t care about the number of segments, just which airline you fly.

Here’s the real power of ITA Matrix: You can even enter multiple airports for your departure and destination. Perhaps you live in the San Francisco Bay Area and are willing to fly from San Francisco or Oakland, but not San Jose. You want to fly into Washington-Dulles or Washington-Reagan, but not Baltimore. And you want to fly United Airlines or Alaska Airlines, but not any other. You are indifferent to connections.

Departing from > SFO,OAK
Outbound routing codes > UA,AS+
Outbound extension codes >

Destination > IAD,DCA
Return routing codes > UA,AS+
Return extension codes >

This is a lot of detail, but it’s easy to do and will greatly focus your search so that ITA Matrix can focus on providing just the results you want and exhaust all possible options. It will not be distracted by searching for flights on American Airlines or Delta Air Lines, for example.

But let’s go back to our earlier example. It’s winter and you really don’t want to connect in Chicago. You can exclude airlines and airports by using a tilde (“~”).

Departing from > SFO,OAK
Outbound routing codes > UA,AS ~ORD UA
Outbound extension codes >

Destination > IAD,DCA
Return routing codes > ~ORD UA,AS+
Return extension codes >

I want to highlight some important differences here and how to think carefully about how this routing codes work. For the outbound journey, I requested a singleflight (no plus symbol) on United Airlines or Alaska Airlines, I wanted to stop somewhere other than Chicago, and then I wanted to complete the trip on United Airlines.

For the return journey, I provided the same commands with the addition of a plus symbol. (The commands are in reverse order because I’m traveling in the reverse direction.) But now, after avoiding a connection in Chicago I want to take one or more flights on United Airlines or Alaska Airlines to reach Seattle. At this point, ITA Matrix can pick whatever connecting city it wants. It’s entirely possible I could get an itinerary like IAD-PHL-ORD-SEA.

The lesson is to pay close attention. If you really don’t want multiple flights, then don’t let ITA Matrix pick them for you.

Avoid Overly Broad Search Queries

My favorite application of ITA Matrix is creating flexible queries with multiple airport options. Imagine you just want a cheap flight to Europe and don’t care where; you’re going to take the train anyway. ITA Matrix will accept a query with a dozen airports in the destination field separated by commas. The problem is your query will time out after a minute.I’ll reiterate this point in my next post on using the “nearby airports” feature of ITA Matrix.

An overly broad search will still return results, but not all of them, and you might not get the lowest fares available to some of those destinations. If you often find that your queries take a long time, consider breaking them up into smaller pieces and running them separately. Alternatively, adding restrictions like a particular airline will counteract the effect of being too permissive with the number of airports.

Specify Codeshares

It’s important to be clear about the nature of your request when you enter an airline’s code in your query. If you enter “UA” for United Airlines, this will return flights that aremarketed by United Airlines, meaning they have a UA flight number. The majority will probably also beoperated by United Airlines, with their own aircraft, but it’s also possible you’ll get a codeshare. For example, a Lufthansa codeshare could have an LH flight number but be operated by United Airlines.You’ll be able to see codeshares in the search results because an asterisk appears next to the airline code.

Rules for different loyalty programs sometimes mean you’ll earn a different number of miles based on whomarkets the flight or whooperates the flight. You’ll need to look at the rules of the loyalty program to learn more. Sometimes the cost of the flight will also be different. And very often a codeshare prevents you from getting an upgrade. There are a lot of reasons why you will want to force or avoid a codeshare.

There are a few options here. You can do nothing and let ITA Matrix return flights that aremarketed by the airline. You can also add the prefix “O:” to request flights that areoperated by the airline. In this example, only the outbound flight to Frankfurt has this restriction, and the return journey requests a flight marketed by United Airlines.

Departing from > SFO
Outbound routing codes > O:UA
Outbound extension codes >

Destination > FRA
Return routing codes > UA
Return extension codes >

This still doesn’t solve our problem because you can get the reverse issue: Lufthansa-marketed flights operated by United Airlines. You can see that the outbound journey provides the same flight but with different flight numbers.

Search for Flights Like a Travel Agent Using ITA Matrix Routing Language (6)

The return journey provides different flights operated by different carriers, but both with United Airlines flight numbers.

Search for Flights Like a Travel Agent Using ITA Matrix Routing Language (7)

Depending on the route you will want to go one way or the other. If it’s a domestic U.S. flight, for example, Lufthansa-operated flights will be rare and “O:UA” will probably work well.

Specify Booking Classes

All those reasons I gave for paying attention to codeshares? They apply to booking classes, too. (These are also called fare classes.) You may earn a different number of miles, see a different price, and change your eligibility for an upgrade. A common example is trying to use a Global Premier Upgrade (systemwide upgrade) on United Airlines. With some exceptions, you must be flying on a United-operated and United-marketed flight with a fare class of W or higher.

Your average search returns the lowest fare for the cabin specified: the lowest fare in coach, the lowest fare in business, or the lowest fare in first class. If you want a very specific fare that is somewhere in between, you can almost never search for this on other websites. ITA Matrix makes it easy.

This will be our first example of an extension code because it doesn’t affect the route but does adjust the results. Remember that fare extension codes always come last and begin with a forward slash (“/”) when you enter them as part of a single line of code. (Just like how the routing codes are always preceded by two colons, ” :: “.) However, because I’m showing you how to enter the codes separately in each box in the newest version of ITA Matrix, the slash is omitted. It will be easier to show you how the booking class code works with an example.

Departing from > SFO
Outbound routing codes > UA
Outbound extension codes > f bc=w

Destination > FRA
Return routing codes > UA
Return extension codes > f bc=w|v

It might be helpful if you imagine how you might translate this request to English. My extension code says that I want to specify part of my fare (“f”). I want a specific booking class (“bc”) that is W on the outbound journey and either W or V on the return journey. You can enter as many booking classes as you like by separating them with a pipe (“|”), which is a common way of saying “or” in logical operations.

In the example below, you can see that the United-operated flight to Frankfurt that we found earlier is actually a little more expensive, at $1,588 instead of $1,513. This is the extra cost of buying an upgrade-eligible W fare. We can confirm it is a W fare by hovering over the flight here or by selecting it and viewing all the itinerary details on the last page.

Search for Flights Like a Travel Agent Using ITA Matrix Routing Language (8)

Be aware that the airline might not be selling any tickets with the booking class you request, so entering more than one can improve your chances of success. You’ll still get only results for the cheapest booking class within the limitations of a particular query, so if you look for both W and V and both are available, only the cheaper W fare will be returned.

Specify Alliances

You can specify that flights be marketed by a particular alliance so you don’t have to type in all the airline codes. Like the fare class requirement, these are extension codes. (It’s a little weird because when you enter specific airlines those go in the routing code box.) Remember that we use a forward slash for extension codes when we try to type an entire command in one line, but when we use the new ITA Matrix with separate boxes the slash is omitted.

Departing from >
Outbound routing codes >
Outbound extension codes > alliance star-alliance

Alternatively, replace “star-alliance with one of the other alliances:

“alliance star-alliance” to search Star Alliance members like United Airlines
“alliance oneworld” to search oneworld Alliance members like American Airlines
“alliance skyteam” to search SkyTeam members like Delta Air Lines

Be careful when using these commands. Many carriers have non-alliance partners. For example, searching foroneworld Alliance members will not include Alaska Airlines, which is a partner of many alliance members such as British Airways, American Airlines, and Cathay Pacific. Alaska Airlines itself is not a member of any alliance.

If you only care about being able to earn miles with a specific program, using alliance commands are not a perfect solution. A better application might be if you want certain alliance benefits during your trip like priority boarding and lounge access. Or, if you know the local partners in the area where you are traveling, just enter the airline codes manually. Check out this post for more information on using ITA to find or avoid codeshares.

List of Advance Routing Language Commands

My examples are based on ITA’s own instructions, which you can bring up by clicking on the question mark next to each of the advanced routing entry fields. I’ve expanded on them a bit where I felt ITA was unclear. And with that said, I give you the list:

AADirect flight on a specific carrier. In this example, it will be marketed by AA (i.e., AA flight number), but it could be operated by another carrier.
AA+One or more flights on a specific carrier.
AA,UA,DLDirect flight on one of the carriers separated by a comma.
O:AADirect flight on a specific operating carrier. In this example it could be marketed by another carrier (e.g., a BA flight number), but it will be operated by AA.
O:AA,O:UA,O:DLDirect flight operated by one of the carriers separated by commas.
NAny single nonstop flight. This contrasts with a direct flight, which may have a connection or plane change but still uses the same flight number. (This command is rarely used in practice.)
N:AAAny single nonstop flight on AA.
DFWA single connection point at a specified airport. You can also use city codes (e.g., WAS).
DFW, STL, LAXA single connection point at one of the airports separated by commas.
XAny single connection point. Use multiple separated by space to define multiple connections. (This command is rarely used in practice.)
X?Zero or one flights. Use this to permit a connection but leave open the possibility of a nonstop flight.
DFWDirect flight or one connection point at the specified airport.
AA151A specific flight number, in this case American Airlines flight 151.
AA1000-2000A single flight on AA within the range of 1000-2000.
~Negation. Use this to rule out an airline, airport, or flight. For example, use SEA :: ~DEN to allow a flight from Seattle that connects anywhere but Denver.

Various combinations of these commands are possible. For example:

~AA,UA,DL+Any number of flights, but not on AA, UA, or DL.
AA+ DL+One or more flights on AA followed by one or more flights on DL.
AA DL,AFAny direct flight on AA followed by any direct flight on either DL or AF.
AA UA?Any direct flight on AA, optionally followed by another flight on UA.
AA N?Any direct flight on AA, optionally followed by another flight on any airline.
AA25 UA814Two specific flights: AA25 followed by UA814.
AA25 UA+Flight AA25 followed by any number of flights on UA.
DL CHI DLTwo direct flights on DL, separated by a connection in Chicago (either airport, since the city code was used).
EWR CVG SLCThree connections in EWR, CVG, and SLC (in that order).

There are also many other extension codes that I have not discussed in detail here. They should also go in the extension code field by themselves. These were originally detailed by SeattleFred on FlyerTalk but can also be found on the ITA Matrix website. For example, “-overnight” to avoid overnight flights or “-redeye” to avoid redeye flights. Note that these commands use minus signs, not the tildes used for negation in the routing codes above.

-overnightNo overnight stops.
-changeNo airport changes.
-redeyeNo redeye flights.
-propNo propeller planes.
-trainNo trains (e.g., these are sometimes included on United flights to PHL).
-helicopterNo helicopters (I've never seen one).

SeattleFred also tells us how to set connection times and itinerary duration. These commands must also be placed in the routing code box, e.g., “minconnect 60” for a minimum connection time of 60 minutes. Note that the command for maximum duration requires three digits, not two.

minconnect XXMinimum connection of XX minutes.
maxonnect XXMaximum connection of XX minutes.
padconnect XXRequire XX minutes in addition to the airline's minimum recommendation.
maxdur XXXMaximum total trip duration of XXX minutes.

Read This Next

  • How to Use ITA Matrix to Find the Best Flight

  • More Tips on ITA Advanced Routing Language

  • ITA Matrix Gets an Update

Search for Flights Like a Travel Agent Using ITA Matrix Routing Language (2024)


Is ITA Matrix better than google flights? ›

However, ITA Matrix is a tool for intermediate to advanced travelers looking to book specific flights. For most travelers, a flight search tool such as Google Flights will be the best option for searching and booking flights.

Did Google buy the ITA Matrix? ›

In July 2010, Google announced the acquisition of ITA for $700 million in cash, subject to DOJ review and approval. On April 8, 2011, the US Dept. of Justice and Google reached an agreement in terms to allow the purchase and dismiss a potential antitrust lawsuit.

Who owns the ITA Matrix? ›

ITA Matrix is a powerful flight search engine that's been around since 1996. Originally developed by computer scientists at MIT, it was acquired by Google in 2011 and became the basis for Google Flights.

What is the ITA Matrix on Expedia? ›

Pros of the ITA Matrix

For instance, on Expedia you're locked into searching one date at a time. The ITA Matrix allows you to select options like a day before, after, or plus/minus 1- 2 days. That little extra flexibility gets you to a ticket faster and could save you money if traveling on another day is cheaper.

What is the baggage allowance for ITA Matrix? ›

The weight limit for checked baggage on ITA Airways ranges from 23 kg to 50 kg, depending on the class of travel and destination. ITA Airways applies a standard baggage allowance for additional checked baggage, but this option is not available for flights operated by other carriers or departing from specific airports.

How far in advance should you buy international plane tickets? ›

Best Time To Book International Flights

According to Expedia's study, data shows that you want to book at least six months in advance for international travel. The study found you'll save an average of 10% by booking six months in advance instead of two months or less.

Why is airfare so expensive right now? ›

“Not only the airlines but also airport service providers made massive layoffs during the pandemic and have not been able to go back to the previous capacity yet.” If labor is more expensive and not at full capacity, you could have fewer flights and higher costs.

What is the difference between ITA and Alitalia? ›

Alitalia officially ceased operations in late 2021, when it was reborn as ITA. When Italy's national airline Alitalia stopped flying in 2021 after decades of losses and numerous brushes with bankruptcy, it was the end of an era.

Does ITA have a website? ›

Then you're just one step away from packing your bag! Enter the "Manage Flight" section on the website or in the ITA Airways app; Enter the PNR you received by email by completing it with your last name; Finish your booking by paying the ticket price!

Who is buying ITA? ›

Lufthansa is planning to buy the stake in ITA from the Italian Treasury for 325 million euros ($352 million).

Is there a better flight search than Google? ›

Bottom line: Google Flights and Skyscanner are two of the best sites for searching for flights. Both have some great functionality, but each also has some areas for improvement. That's why we often recommend pairing multiple search sites to ensure you're getting the best deal.

Are ITA Airways reliable? ›

ITA Airways is a Italian carrier. Frequent travelers give the airline an average rating of 6.8/10. This is below the general average .

Is it good to book flights through Google? ›

Google Flights is a reliable, legitimate, and trustworthy site for flight searching. In general, its prices are accurate and reflect the same prices as you'll find on the airline websites and other OTAs.

Which flight company is the best? ›

At the top of the 2023 ranking is Singapore Airlines, followed by Qatar Airways and ANA All Nippon Airways in second and third place. Emirates and Japan Airlines secure fourth and fifth places, while Turkish Airlines, Air France, Cathay Pacific Airways, EVA Air and Korean Air also feature in the top ten.


Top Articles
Latest Posts
Article information

Author: Mr. See Jast

Last Updated:

Views: 5869

Rating: 4.4 / 5 (75 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Mr. See Jast

Birthday: 1999-07-30

Address: 8409 Megan Mountain, New Mathew, MT 44997-8193

Phone: +5023589614038

Job: Chief Executive

Hobby: Leather crafting, Flag Football, Candle making, Flying, Poi, Gunsmithing, Swimming

Introduction: My name is Mr. See Jast, I am a open, jolly, gorgeous, courageous, inexpensive, friendly, homely person who loves writing and wants to share my knowledge and understanding with you.