At a Brent price of $116.72 a barrel, a litre costs $0.7341 and a US gallon $2.78. A barrel is 42 US gallons or 158.987 litres, so divide the barrel price by 42 for a gallon and by 158.987 for a litre.
Convert the barrel price with the API
Brent and WTI are futures-based reference prices quoted in USD only. The conversion changes the volume unit while keeping the price in dollars. Use the barrel price returned by the API as the starting value for each calculation.
- Set your API key Get a free key and keep it in an environment variable called
NARWHAL_API_KEY. Narwhal uses one account and one API key across its data APIs, and REST and MCP share that key. - Read Brent and calculate each unit price The Python request sends the key as
Authorization: Bearer YOUR_KEYtohttps://api.narwhalapi.com. It reads the decimal string inpriceas a number, then prints the barrel price and the converted prices.Python, Brent per litre and per gallonimport os import requests H = {"Authorization": f"Bearer {os.environ['NARWHAL_API_KEY']}"} brent = float(requests.get("https://api.narwhalapi.com/v1/commodities/spot/BRENT/USD", headers=H, timeout=10).json()["price"]) LITRES_PER_BARREL = 158.987294928 # 42 US gallons print(f"per barrel ${brent:.4f}") print(f"per litre ${brent / LITRES_PER_BARREL:.4f}") print(f"per US gal ${brent / 42:.4f}") print(f"per imp gal ${brent / (LITRES_PER_BARREL / 4.54609):.4f}") - Match the response to the calculation The response contains
symbol,price,currency,unit,timestampandstale; the unit isbarrel. Keep that starting unit in mind when using the result in a sheet, because the litre and gallon formulas each expect a barrel price. - Use WTI when you need that reference For WTI, use
/spot/WTI/USDin place of/spot/BRENT/USDwithin the commodity request path. The same barrel conversion applies to either reference, so the volume divisors stay the same when the oil symbol changes.
The script uses 158.987294928 litres per barrel in its calculations and prints each result to four decimal places. Keep the full conversion value in a formula when calculating the litre price. The US gallon calculation uses 42 directly; the imperial calculation first expresses the barrel volume in imperial gallons, then divides the price by that volume.
Convert the price in a sheet or without code
For a one-off conversion, use the commodity converter. Choose the unit you need for the oil price. This is the website route when you want a converted value without putting the API request and calculation into a script.
For a pricing sheet, put the USD barrel price pulled from the API in B1. Divide that cell by the litres per barrel for a litre price, or by the US gallons per barrel for a US gallon price. Both formulas use the same starting cell.
Use the litre formula when the price you need is for a litre, and the US gallon formula when the price you need is for a US gallon. If you change the barrel input from Brent to WTI, leave the divisors in place. Both references are quoted per barrel, and both prices are in USD.
=B1/158.987294928=B1/42Label the result with both the currency and the volume unit, such as USD per litre or USD per US gallon. A value labelled only as a gallon price leaves the gallon definition unclear. Keep the barrel input separate from the formula cells so the input remains a price per barrel.
Why is crude per litre far below the pump price?
The spot price is crude oil only; pump prices add refining, distribution and taxes. Converting a barrel quote to litres changes its unit, so the result still describes crude oil. Those pump-price additions are outside this number.
If your question concerns fuel bought at the pump, keep the crude conversion separate from the retail price. A crude price per litre and a pump price per litre share a volume unit, but they do not describe the same price. Do not compare them as like for like.
Which gallon do I use for an oil price?
Use a US gallon for US prices and an imperial gallon for UK-style quotes. A US gallon is 3.785 litres, while an imperial gallon is 4.546 litres. A barrel holds 42 US gallons; that count applies specifically to the US gallon definition.
For the imperial calculation, use 4.54609 litres per imperial gallon and 158.987294928 litres per barrel. Dividing the barrel volume by the imperial gallon volume gives 34.9723 imperial gallons per barrel. Use that volume relationship when converting the barrel price to an imperial gallon price.
Is the converted oil price live?
On the Free plan, spot prices use the previous UTC day's close. The timestamp and stale fields tell you what you got. Read them alongside the price so the time attached to the barrel quote stays attached to its litre and gallon equivalents.
The arithmetic uses the quote returned in price. Converting that quote to another volume unit does not change its timestamp. For example, the Brent quote used on 24 October 2026 was dated 23 October 2026, so its converted values belong to that quote too.
Worked example: Convert Brent on 24 October 2026
On 24 October 2026, Brent's quote dated 23 October 2026 was $116.8809 a barrel. Start with that barrel price for each division. For litres, divide by 158.987294928. For US gallons, divide by 42. For imperial gallons, divide by the barrel's 34.9723 imperial gallons.
To reproduce this dated example in a pricing sheet, enter 116.8809 in B1 as the USD barrel price from the 23 October 2026 quote. Apply the litre formula to that input and the US gallon formula to the same input. Each result starts from the barrel quote; the gallon calculation does not use the rounded litre result.
| Unit | Calculation using the 23 October 2026 quote | USD per unit for the 23 October 2026 quote |
|---|---|---|
| Litre | 116.8809 / 158.987294928 | $0.7352 |
| US gallon | 116.8809 / 42 | $2.7829 |
| Imperial gallon | 116.8809 / 34.9723 | $3.3421 |
Published .
