Problem
With the tax reform approved, business owners and accountants still lack a quick way to estimate whether a company will pay more or less tax under the new model.
technical case study
SaaS • Tax simulator / Web app
Free simulator that estimates how Brazil's tax reform (IBS + CBS) changes a company's tax burden, comparing its current regime with the new model.
Home page: the tax reform question up front and the simulator right below it, no sign-up needed.
Simulation for a retail business under Lucro Presumido: current tax, tax under the reform and the difference in reais and percent.
Current vs. reform chart, the assumptions used in the calculation, a written diagnosis and the waitlist for the full app.
Result on a phone, with the same details as the desktop version.
With the tax reform approved, business owners and accountants still lack a quick way to estimate whether a company will pay more or less tax under the new model.
A web simulator that takes revenue, tax regime, sector, margin, payroll, inputs and state, and compares the current monthly tax with the estimate under the dual VAT (IBS + CBS), including input credits.
Instant results with no sign-up: current and reform values, the difference in reais and percent, a comparison chart and a written diagnosis with the assumptions used.
Karpaz's own product, with the MVP live at safyr.com.br and a waitlist for the full app (saved profile and documents for tax filing).
Brazil's tax reform replaces PIS, COFINS, ICMS and ISS with a dual VAT: the federal CBS and the IBS, shared by states and municipalities. Safyr was created to quickly answer the most common question about it: will my company pay more or less? The simulation uses the Simples Nacional tables (LC 123/2006), the Lucro Presumido and Lucro Real rules and the IBS + CBS reference rate from LC 214/2025, and makes clear that it is an estimate, not a professional tax analysis.
A single page in HTML and CSS with JavaScript modules (ES modules): a form that shows the right fields for each sector, a detailed result, a custom bar chart with tooltips and a background of stripes that stack up over time.
The calculation runs entirely in the browser (calc.js), with tables and rates kept in a separate data module. On the server, a PHP endpoint only receives the email of people who want to hear about the full app.
The simulation numbers never leave the browser. Only the waitlist email goes to the server, after passing Cloudflare Turnstile, a honeypot field against bots and a rate limit.
Revenue, margin and the company's other numbers are calculated in the browser itself; none of it is sent to the server.
The email form uses Cloudflare Turnstile and a hidden field (honeypot) that only bots fill in.
The server limits repeated submissions and the interface explains what to do when the limit is reached.
Gathering the Simples Nacional tables, the Lucro Presumido presumptions, the Lucro Real rules and the IBS + CBS reference rate.
Separate functions per regime and a module just for the tables, so rates can be updated without touching the logic.
A form that adapts to the sector, a detailed result, a comparison chart and a written diagnosis.
Site live on its own domain, with protected email capture to announce the full app.
export function calcularImpostoReforma(receitaMensal, baseCreditavel) {
const ivaTotal = REFORMA.ibs + REFORMA.cbs;
const impostoBruto = receitaMensal * ivaTotal;
const credito = baseCreditavel * ivaTotal;
const impostoFinal = impostoBruto - credito;
return {
valor: impostoFinal < 0 ? 0 : impostoFinal,
ivaTotal,
ibs: REFORMA.ibs,
cbs: REFORMA.cbs
};
}
export function calcularLucroPresumido(receitaMensal, setor, aliquotaSetorial) {
const baseIrpj = receitaMensal * (PRESUNCAO_IRPJ[setor] || 0);
const baseCsll = receitaMensal * (PRESUNCAO_CSLL[setor] || 0);
const irpj = baseIrpj * ALIQUOTAS_PRESUMIDO.irpj;
const adicionalIrpj = Math.max(0, baseIrpj - IRPJ_ADICIONAL.limiteMensal) * IRPJ_ADICIONAL.aliquota;
const csll = baseCsll * ALIQUOTAS_PRESUMIDO.csll;
const pis = receitaMensal * ALIQUOTAS_PRESUMIDO.pis;
const cofins = receitaMensal * ALIQUOTAS_PRESUMIDO.cofins;
const impostoSetorial = receitaMensal * aliquotaSetorial;
return irpj + adicionalIrpj + csll + pis + cofins + impostoSetorial;
}
export function renderGrafico(els, { impostoAtual, impostoReforma, diferencaReais }) {
const maxValor = Math.max(impostoAtual, impostoReforma, 1);
const larguraAtual = Math.min((impostoAtual / maxValor) * 100, 100);
const larguraReforma = Math.min((impostoReforma / maxValor) * 100, 100);
const valorAtualFormatado = formatCurrency(impostoAtual);
const valorReformaFormatado = formatCurrency(impostoReforma);
els.barAtualEl.style.width = `${larguraAtual}%`;
els.barReformaEl.style.width = `${larguraReforma}%`;
// A barra "Reforma" é a única com sentido de bom/ruim (é o que muda em
// relação ao cenário atual), então ela usa uma cor de status; a barra
// "Atual" é só o contexto/referência e fica neutra.
let corReforma = "var(--warning)";
if (diferencaReais > 0) corReforma = "var(--danger)";
else if (diferencaReais < 0) corReforma = "var(--success)";
els.barReformaEl.style.background = corReforma;
els.graficoValorAtualEl.textContent = valorAtualFormatado;
els.graficoValorReformaEl.textContent = valorReformaFormatado;
els.barAtualEl.dataset.categoria = "Imposto atual";
els.barAtualEl.dataset.valor = valorAtualFormatado;
els.barReformaEl.dataset.categoria = "Imposto com a reforma";
els.barReformaEl.dataset.valor = valorReformaFormatado;
els.graficoVazioEl.classList.add("hidden");
els.graficoComparativoEl.classList.remove("hidden");
}
In a few seconds, a business owner sees an estimate of the reform's impact on their case, along with the numbers behind it. The simulator also measures interest in the full app through the email waitlist.
Turning legislation into an interface means being clear about what is an estimate: the assumptions, the source of the rates and the limits of the calculation appear right next to the result.