A CEO Asked for a SARS Provisional Tax Calculator — So I Shipped a Pure TypeScript Engine in 24 Hours
Yesterday I posted a quick 2026/27 South Africa SARS PAYE breakdown on LinkedIn. It crossed 100,000 impressions, and a South African CEO commented asking for the same browser-local tool for Provisional Taxpayers (IRP6).
Yesterday I posted a quick 2026/27 South Africa SARS PAYE breakdown on LinkedIn. It crossed 100,000 impressions, and a South African CEO commented asking for the same browser-local tool for Provisional Taxpayers (IRP6).
So I spent the last 24 hours translating South Africa's 2026/27 and 2025/26 SARS Fourth Schedule rules into a pure TypeScript engine and shipped the South Africa Provisional Tax (IRP6) Calculator on KivaroTools.
Here are three practical engineering lessons from building a real statutory calculator—including a subtle UX math bug I caught right before launch.
1. Make Bracket Evaluation Generic Across Tax Regimes
South African provisional taxpayers don't all sit on the same table. A sole proprietor pays progressive individual rates (18% to 45%), a qualifying Small Business Corporation (Section 12E SBC) pays 0% up to R99,000, 7% up to R365,000, 21% up to R550,000, and 27% above that, while a standard Pty Ltd pays a flat 27% CIT.
Instead of duplicating loops, I modeled both individual and SBC regimes with one typed TaxBracket[] evaluator so the UI can compare Individual vs. SBC vs. 27% CIT on the exact same taxable income in a single pass:
export interface TaxBracket {
min: number;
max: number;
baseTax: number;
rate: number;
}
export function calculateTaxFromBrackets(
taxableIncome: number,
brackets: TaxBracket[]
) {
const income = Math.max(0, Number.isFinite(taxableIncome) ? taxableIncome : 0);
let marginalRate = brackets[0].rate;
let grossTax = 0;
for (const bracket of brackets) {
if (income > bracket.min) {
marginalRate = bracket.rate;
}
if (income > bracket.min && income <= bracket.max) {
grossTax = bracket.baseTax + (income - bracket.min) * bracket.rate;
}
}
return {
grossTax: Math.round((grossTax + Number.EPSILON) * 100) / 100,
marginalRate,
};
}
On R550,000 taxable profit in 2026/27, that side-by-side pass immediately surfaces a R91,030 gap: R57,470 for a qualifying SBC versus R148,500 at the flat 27% corporate rate.
2. The Hidden Input Trap I Caught Before Deploying
When designing the React form (SaProvisionalTaxCalculator.tsx), I kept the default screen clean by putting Full-Year PAYE Withheld in the main visible grid and moving PAYE Withheld (Mar – Aug) into a collapsible Advanced drawer.
During pre-launch testing, I spotted a nasty edge case: if a salaried user with a side hustle entered R780,000 taxable income and R136,000 Full-Year PAYE without opening the Advanced drawer, Period 1 PAYE defaulted to 0. That overstated their 1st IRP6 payment by R68,000 (R100,116.50 instead of R32,116.50) and zeroed out Period 2.
The fix took four lines in useMemo:
const parsedFullYearPaye = parseNum(form.payePaidFullYear);
const parsedPeriod1Paye = form.payePaidPeriod1.trim()
? parseNum(form.payePaidPeriod1)
: Math.round((parsedFullYearPaye / 2) * 100) / 100;
If the user leaves Period 1 PAYE blank, it automatically splits full-year PAYE 50/50 across Period 1 and Period 2—giving the exact R32,116.50 / R32,116.50 split—while still letting accountants override the March–August figure inside the Advanced drawer.
3. Modeling the R1,000,000 Paragraph 20 Cliff and Section 89quat Interest
The biggest trap for high-earning South African consultants and directors is crossing R1,000,000 in final assessed taxable income:
- At or below R1,000,000, your prior-year SARS Basic Amount still acts as a safe harbor.
- Above R1,000,000, the Basic Amount offers zero protection—your 2nd IRP6 estimate must reach at least 80% of actual taxable income, or SARS levies a 20% underestimation penalty (source code
9990). - Even without a Paragraph 20 penalty, any unpaid balance remaining after 30 September accrues Section 89quat interest (source code
9988) once taxable income exceeds R50,000 (individuals) or R20,000 (companies).
By letting users test a simulated final ITR12/ITR14 income against their 2nd IRP6 estimate right in the browser, they can see their exact Period 3 voluntary top-up before the 30 September cutoff.
Zero Server Uploads
Every calculation runs inside browser RAM on Next.js 16, React 19, TypeScript 5, and Tailwind CSS 4—no backend database, no sign-up walls, and no third-party tracking of financial inputs.
Try it out here: South Africa Provisional Tax (IRP6) Calculator or browse the rest of the 48+ browser-local utilities on KivaroTools.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.