Image: Gas pump © Comstock

Gas prices got your attention? You're probably asking where all the money you're shelling out at the pump is going.

There are a couple of ways to answer that.

Industry shows how gas price breaks down

The American Petroleum Institute says it takes one gallon of oil to make a gallon of gasoline. The price of oil is determined in commodity markets, where companies and traders buy and sell petroleum for purposes that can include refining it into gasoline and holding it as an investment. The markets, and the prices they set, are influenced by supply-and-demand factors, such as trouble in the Middle East that could result in less oil coming from that region of the world.

After oil prices, the rest of the price of a gallon of gas comes from taxes (14%) and costs associated with refining, moving and selling the gasoline (15%), according to the API.

At the time of the API's most recent study, in late February, the national average price of regular-grade gasoline was $3.58 per gallon. By the group's estimates and percentages, about $2.54 of that price covered crude oil costs, 50 cents went to taxes, and about 54 cents went into refining, moving and retailing.

Get geeky for more exact gas cost analysis

If you want to get geekier about where your gas money is going, you can do a more exact and up-to-date calculation on your own. Here's how:

  • Find the price of a gallon of gas. Go online to AAA's Daily Fuel Gauge Report. For example, as of June 29, the auto club showed that a gallon of regular gasoline sold for about $3.35.
  • Find the price of a gallon of oil. Head to Bloomberg.com's Energy & Oil Prices page. As of June 29, it showed a barrel of oil selling for about $83.99. There are 42 gallons in a barrel of oil, so divide $83.99 by 42 to get $1.99 as the price of one gallon of oil. Again, a gallon of oil can be refined into one gallon of gasoline, according to API. So, about $1.99 of the June 29 price for a gallon of gas went toward the cost of the underlying oil. That works out to about 65% of what you paid at the pump.
  • Find the cost of taxes. The federal tax on gasoline is 18.4 cents per gallon. On top of that, there are state taxes and, depending on where you live, local gasoline and/or sales taxes, too. If taxes are typical where you are, the API estimates, you're paying 49 cents per gallon in federal, state and local gas taxes, making up 14.6% of the average $3.35 gas price.
  • Determine the cost of refining, transportation and retailing. The rest of the cost of gasoline goes to turning crude oil into fuel, moving it to gas stations and retail markup. Get this number by subtracting the amounts in steps 2 and 3 from the average price in step 1. In this case, that's $3.35 minus $1.99 and minus 49 cents, which comes out to 87 cents for refining, transportation and retailing -- or about 26%.

And that's how you do the math. Keep in mind that taxes and other factors that make up gas prices can differ by region, state, metro area and city. Check out Bankrate's map of gasoline taxes by state to see how much of your gas money is going to federal and state taxes.

If you want more details about your own local taxes, contact your city, county, and/or state department of revenue, department of finances or the equivalent.

Click here to become a fan of MSN Money on Facebook

More from Bankrate.com: