NEW YORK (MainStreet)—A myriad of factors contribute to the cost of gasoline, which is why consumers see price fluctuations when they go to different pumps or pay less when they travel to other states. And as people get ready to hit the road for July 4 getaways, they're ever eager to know how badly they're going to get dinged at the gas station.

Gasoline is derived from crude oil, which affects 63% of the cost. Crude oil prices fluctuate often from issues arising from supply and demand by the sellers and buyers in the market and political turmoil, said David Zahn, vice president of marketing for FuelQuest, a Houston-based software company that manages supply chain for suppliers and purchasers of fuel such as FedEx and UPS.

The cost to refine crude oil or to produce it into gasoline contributes another 16% while distribution, marketing and retailing make up another 10%.

The proximity to where the refineries are located also factors into the price, said Brian Milne, energy editor and product manager for Schneider Electric. The cost decreases when consumers live closer to refineries, because there is more availability and transportation costs are lower, he said.

Also see: Financing Fertility Options in the U.S.>>

"A refiner situated by low cost crude oil supply offers the greatest discount for a US driver," said Milne.

The remaining 11% is derived from federal and state taxes. The current federal tax rate is 18.4 cents per gallon. Since each state determines its own tax rate, the retail price can vary widely. The average rate is 23.5 cents currently, said Zahn. In California, consumers pay 48.7 cents in taxes for gasoline, while residents in Alaska pay only 8 cents, he said.

Some states such as California are also required to sell a fuel type that has greater environmental restrictions due to pollution issues, said Milne. The stricter environmental regulations can ramp up the cost of manufacturing gasoline in those states.

Variations in the price also occur throughout the year, depending on the season because of the different blends that are created, said Bernard Weinstein, associate director of the Maguire Energy Institute at SMU Cox School of Business in Dallas.

"It is a seasonal cost," he said. "Generally speaking, gasoline is more expensive in the summer because refiners have to reformulate the gasoline. It adds additional cost to the refining cost and that gets passed onto customer."

Gasoline prices tend to rise during the summer when usage increases, but inventory levels for this summer are "plentiful," he said.

"I don't think we will see any spikes like last summer," he said. "We are producing more oil in the U.S. now than the 1960s. The supply is adequate."

Contrary to public perception, retailers of gasoline such as ExxonMobil or Shell only profit 1 to 2 cents per gallon, depending on the market, said Zahn. Retailers are also subject to the spikes in the market.

Also see: Measuring the Economic Impact of the Arms Trade Treaty>>

"Retailers are scrambling to source and get the least expensive fuel so they can price more aggressively at the pump," he said. "The thing that is really important to understand is that these high gas prices are not going away. The volatility behind gas prices is not going away either. Retailers have to be smart about how they buy fuel. The ones that are good at it are hopefully the ones we shop at."

Swings in the price of gasoline are occurring more frequently now, said Zahn. Now consumers experience price swings of three cents or more nearly 50% of the time compared to just 6% before 2004, he said.

Also see: State and District Breakdowns for Gender Wage Gaps >>

"Prior to 2004, fuel buyers were less concerned with day-to-day price changes – five cents or more moves occurred only 1.5% of the time," Zahn said. "Today, they happen 25% of the time. This volatility and its potential to impact margin negatively are permanent fixtures for retailers."

Consumers can easily find cheaper gas prices at big box stores such as Costco or Sam's and large grocery store chains that offer reward points that can shave off several cents on each gallon, he said.

It is relatively easy for consumers to shop around for prices by looking online or using mobile applications, said Zahn. One good resource is, which utilizes crowdsourcing or users who provide real-time data on the cheapest gas prices.

Also see: 6 Simple Ways to Lower Your Energy Costs This Summer>>

"Gas prices are not all the same," he said "You can get a discount of five cents pretty close to you."

With a slump in demand currently, prices will start to "creep down a little bit," said Zahn.

Prices should continue to drop for the July 4 weekend and are expected to range from $3.50 to $3.54 for the holiday weekend.

--Written by Ellen Chang for MainStreet