Pakistan Petrol Prices: Every Number Has a Source

Summary
Pakistan's official fuel prices with full history, plus calculators for your monthly fuel cost and for fuel claims priced at each day's real rate. Every number shows its source.
My part
The problem
In Pakistan, petrol and diesel prices are set by OGRA, the regulator, and they change on most weekdays. In September 2026, the petrol price in force ranged from Rs 342.79 to Rs 393.75 a litre. The official figures are published as PDFs on OGRA's website. Most sites that repeat them don't say where a number came from or when it was last checked, and none of them help with the questions that follow a price change: what does my commute cost now, and how much fuel can I claim back?
It's built for:
- drivers checking today's rate;
- commuters working out what a month of driving costs;
- employees and businesses settling fuel claims;
- journalists and developers who want a clean, sourced history.
The rule it never breaks
Never show a number without saying where it came from, and never charge a past day at today's price.
- A price is only marked "Verified from OGRA" once it matches OGRA's own notification.
- A newer figure from a secondary source (OilPrices.pk) can appear before OGRA publishes, but it's clearly labelled "not yet verified from OGRA".
- If a sync fails, the last verified price stays on the page, with a note saying so, instead of a guess. With no data at all, the page shows an empty state and the API returns an error rather than a made-up number.
- The calculators charge every day at the rate that was actually in force on that day.
Each of these is covered by tests, including end-to-end tests for the failed-sync and no-data cases.
What you can do on it
Check today's price
Petrol and diesel each have a page with today's notified price, the change since the last notification, and when the source was last checked. A plain note explains that this is the ex-depot price, before fuel is trucked to your pump, so what you pay at the pump can be higher. "Why did this change?" leads to the official inputs behind it.
Work out what your commute costs
The fuel cost calculator asks for what Pakistani drivers already know: your average in kilometres per litre, how far you drive in a day, and how many days a month you actually commute. Presets cover a motorcycle (45 km/L), a small car (13 km/L) and an SUV (8 km/L).
It gives you the monthly cost, the litres used, and the cost per kilometre and per day. It shows the sum behind the number, tells you how much the latest price change adds to or saves on your month, and answers "what does Rs 2,000 buy?" in litres and kilometres.
Claim fuel for the days you actually drove
The reimbursement calculator is for anyone claiming fuel from an employer. Pick the period and the weekdays you drive, add or remove individual days that broke the pattern, and it charges each driving day at the price that was in force on that day. Weekends and gaps between notifications carry the last notified price forward.
For a small car doing 40 km on each of September's 22 weekdays, the claim comes to Rs 25,335.32. Charging those same days at today's price would give Rs 26,444.68, Rs 1,109 too much. The page shows both, so the difference is visible to whoever approves the claim.
Explore the history
The history page filters by fuel, year and date range, with quick presets for the last 30 days, this year and all history. Every row links to its source and is labelled either "Official document verified" or as an imported record. The trend chart, from 7 days to all time, is drawn as steps: each price holds until the next notification, and no points are invented in between. A table of the exact values sits beside it.
See what moved the price
The benchmarks page shows OGRA's own Platts, Dubai crude and exchange-rate figures behind price changes. It says plainly that it is not a forecast, and a test makes sure that sentence stays.
Use the data
A small public JSON API returns the latest price and the full history, documented on the site.
How it works
- A scheduled job runs once a day. It fetches OGRA's list of price notifications and checks up to four PDFs per run: always the newest, plus older ones to fill any gaps.
- It extracts the text and accepts exactly one total-price row. Missing or ambiguous totals are rejected, never guessed, and the document's date must match the date OGRA lists it under.
- Each document is hashed, so if OGRA quietly corrects a PDF later, the change is caught.
- New readings are stored separately from the prices the site shows, and a single database transaction reconciles them, so a bad batch can't leave half-written data behind.
Decisions worth explaining
Price each day, not the month
The first version of the claim feature priced a whole month at today's rate. With prices rising, a test month came out at Rs 26,482.58, against Rs 24,545.87 with an average across the month. Averaging fixed most of the gap, but it still billed people for prices on days they never bought fuel. So claims moved to their own calculator that prices only the days actually driven, each at its own rate, and shows the average only to explain the total, not to produce it.
Calculators that need no JavaScript
Both calculators are plain forms, and your inputs live in the page address. A result can be bookmarked, sent to whoever approves your claim, or opened on an old phone with JavaScript switched off. Nothing is stored on a server.
Getting past OGRA blocking cloud servers
OGRA's site refused requests from Vercel. Moving to other regions didn't help, and neither did a Cloudflare Worker relay. The evidence pointed to OGRA blocking cloud and hosting networks in general, so requests now go through ZenRows. ZenRows reports every response as plain text, so the sync checks that each file really starts like a PDF before parsing it.
Free plans only
The whole site runs on free tiers: Vercel, Supabase and ZenRows. That shaped the rest: one sync a day, a small PDF budget per run, and no paid scraping infrastructure.
Built to be found and used
Each page carries one plain sentence stating the price, written so search results and AI assistants can quote it accurately. Structured data marks the price up as an observation rather than a product for sale, and the history as a dataset. Automated accessibility checks (WCAG 2.1 AA) run on every main page, and layouts are tested from 320 to 1440 pixels wide with no sideways scrolling.
Limits
- It syncs once a day, so a new price can take until the next run to appear.
- When sources disagree, someone has to look at it manually.
- Free plans can change, and fetching from OGRA currently depends on ZenRows' free tier.
- A claim is saved and shared as a link; there's no PDF or spreadsheet export yet.
How it was built
AI coding agents (Codex, then Claude Code) wrote most of the code from a written spec. The sourcing rules, how to respond when OGRA blocked us, the decision to show unverified figures only when they're clearly labelled, and pricing claims day by day were mine.

System Visuals

Have a similar engineering problem?
Let’s discuss your requirements, constraints, and what a useful solution would look like.