<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Qaiser Mahmood</title>
    <description>The latest articles on DEV Community by Qaiser Mahmood (@qaiser_mahmood_b83723f8bd).</description>
    <link>https://dev.to/qaiser_mahmood_b83723f8bd</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4212910%2Fc6587c6a-373c-442e-9354-b9b1eb94b96f.png</url>
      <title>DEV Community: Qaiser Mahmood</title>
      <link>https://dev.to/qaiser_mahmood_b83723f8bd</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/qaiser_mahmood_b83723f8bd"/>
    <language>en</language>
    <item>
      <title>I built a Nigeria PAYE calculator for the 2026 Tax Act — and tested it like the statute is the spec</title>
      <dc:creator>Qaiser Mahmood</dc:creator>
      <pubDate>Wed, 28 Oct 2026 11:34:01 +0000</pubDate>
      <link>https://dev.to/qaiser_mahmood_b83723f8bd/i-built-a-nigeria-paye-calculator-for-the-2026-tax-act-and-tested-it-like-the-statute-is-the-spec-329k</link>
      <guid>https://dev.to/qaiser_mahmood_b83723f8bd/i-built-a-nigeria-paye-calculator-for-the-2026-tax-act-and-tested-it-like-the-statute-is-the-spec-329k</guid>
      <description>&lt;p&gt;Nigeria's Tax Act 2025 (signed 26 June 2025, in force 1 January 2026) rewrites personal income tax from scratch. The old PITA bands — 7% to 24% from the first naira, with the Consolidated Relief Allowance — are gone. In their place: a ₦800,000 tax-free band, then 15% / 18% / 21% / 23% / 25% up the scale, a ₦840,000 minimum-wage exemption, and rent relief.&lt;/p&gt;

&lt;p&gt;I built a free calculator for it — &lt;a href="https://toolnestcalc.com/nigeria-paye-calculator-2026/" rel="noopener noreferrer"&gt;Nigeria PAYE Calculator 2026&lt;/a&gt; — and this post is about the part I found genuinely interesting as a developer: &lt;strong&gt;testing a calculator whose spec is a statute.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;The spec is a law, so the test cases come from the law&lt;/h2&gt;

&lt;p&gt;Most calculator bugs I found while researching weren't code bugs — they were &lt;em&gt;spec&lt;/em&gt; bugs: published band tables that don't match the Act. One ranking calculator whose middle bands contradict the Act's Fourth Schedule (18% stopping at ₦10M instead of ₦12M). Another still applying the CRA, which the Act abolished outright.&lt;/p&gt;

&lt;p&gt;So the testing approach: the band table goes in as data, straight from the Fourth Schedule (s.58), and every number on the page has to survive a set of hand-computed cases:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
&lt;strong&gt;Boundary cases&lt;/strong&gt;: exactly ₦800,000 (last naira of the free band), ₦800,001 (first naira at 15%), ₦3,000,000 / ₦12,000,000 / ₦25,000,000 / ₦50,000,000 band edges.&lt;/li&gt;
  &lt;li&gt;
&lt;strong&gt;The exemption edge&lt;/strong&gt;: ₦840,000 gross pays zero — not because of the ₦800k band, but because of the explicit minimum-wage exemption. A calculator that only implements the bands gets this wrong.&lt;/li&gt;
  &lt;li&gt;
&lt;strong&gt;The abolished rule&lt;/strong&gt;: any trace of the old CRA formula (max(₦200,000, 1% of gross) + 20% of gross) is a fail.&lt;/li&gt;
  &lt;li&gt;
&lt;strong&gt;Cross-check against a published worked example&lt;/strong&gt;: ₦5,000,000 gross, 8% pension, no rent relief → chargeable ₦4,600,000 → ₦618,000 tax. Matched to the naira.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;18 cases, 18 passing. The harness earned its keep before publish: it caught the old-law comparison implementing CRA as ₦200,000 + 20% of gross, when the actual PITA formula is max(₦200,000, 1% of gross) + 20% of gross — identical below ₦20M/yr, wrong above it. The kind of bug no amount of staring at the code finds, because the code looks right; only the worked example disagrees.&lt;/p&gt;

&lt;p&gt;The page also ships a side-by-side NTA-2026 vs PITA-2025 comparison ("are you better off?") — the old bands run through the same engine with the old rules, which doubles as a regression check that the two rule sets never leak into each other.&lt;/p&gt;

&lt;h2&gt;Three things I'd tell anyone building a tax/finance calculator&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;
&lt;strong&gt;Cite the schedule and section on the page, with a date.&lt;/strong&gt; "Verified against the Nigeria Tax Act 2025, Fourth Schedule / s.58" is both a trust signal and a forcing function — it makes stale data embarrassing, which is the point.&lt;/li&gt;
  &lt;li&gt;
&lt;strong&gt;Test the repealed rules, not just the current ones.&lt;/strong&gt; The most dangerous bug class is a rule that &lt;em&gt;used to be true&lt;/em&gt;. The CRA, the old 7%-from-first-naira bands, the "18% to ₦10M" middle that one rival still shows — each needs an explicit negative test.&lt;/li&gt;
  &lt;li&gt;
&lt;strong&gt;Vanilla JS is enough.&lt;/strong&gt; No framework, no backend, no build step: a band table as data, pure functions for chargeable income → tax, and the test harness as a plain list of input/expected pairs. The whole thing is auditable in one read.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;Try it / steal the approach&lt;/h2&gt;

&lt;p&gt;The calculator is free, no signup: &lt;a href="https://toolnestcalc.com/nigeria-paye-calculator-2026/" rel="noopener noreferrer"&gt;Nigeria PAYE Calculator 2026&lt;/a&gt;. It's one of the calculators on &lt;a href="https://toolnestcalc.com/free-online-calculators-tools/" rel="noopener noreferrer"&gt;ToolNestCalc&lt;/a&gt; — Pakistan salary tax, India gratuity, Saudi end-of-service, UAE gratuity, Zakat, US tips/overtime tax, and an AI token cost tool — all built the same way: official text first, worked examples as tests, zero-error bar.&lt;/p&gt;

&lt;p&gt;If you've built calculators against changing regulations, I'd genuinely like to hear how you test them — especially the "rule that used to be true" problem.&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>javascript</category>
      <category>taxes</category>
      <category>nigeria</category>
    </item>
  </channel>
</rss>
