Quick Answer: Brazil's federal tax authority, the Receita Federal, has published the source code of its Brazil tax calculator, the Calculadora de Tributos, on GitHub under the MIT license. The code implements the calculation rules for the CBS and other taxes in the consumption tax reform, so companies and software vendors can reuse the same logic in their own systems.
Brazil's federal tax authority has never before released an official software project in a public development environment. That changed with Portaria Cotec nº 342, signed on 12 November 2026 and published in the Diário Oficial da União on 13 November. The Brazil tax calculator is now available on GitHub, and it's one of the more practical moves in the country's consumption tax reform so far. If you build billing, ERP, or compliance software, this changes where the official rules can live: inside your codebase, not just in a PDF.
What Was Actually Published
The release covers three public repositories under the ReceitaFederal GitHub organization. Each one covers a different slice of the reform:
calculadora-rtc-regime-regular, the calculator for companies under the regular tax regime.calculadora-rtc-simples-nacional, the version for companies under the Simples Nacional regime.calculadora-rtc-gerador-danfse, a component related to generating DANFSe service invoice documents.
All three use the MIT license, one of the most permissive open-source licenses in use. In practice, that means you can copy, modify, embed, and redistribute the code, provided you keep the copyright and license notice. The Portaria also records the hashes of the initial versions of each repository. That lets you confirm that the code you download matches what was officially published, which is a simple but useful integrity check.
The project was built jointly by Receita Federal and Serpro, the federal data processing service. According to Receita Federal's announcement, the calculator's code had already been downloadable from the CBS Platform since 2025. What's new is the venue: GitHub is where the global developer community already works, so the code can now be tracked, forked, versioned, and integrated through the same tools your team uses daily.
Why Publish a Tax Calculator Openly?
The common assumption is that a government tool is a black box you check your numbers against. You enter a transaction, you get a figure, and you hope it matches what the auditor later calculates. Open-sourcing the calculator turns that assumption around. The code becomes the reference implementation, and you can see how each rule is applied rather than guessing from the summary.
The announcement frames this in terms of the OECD's Tax Administration 3.0 concept, in which tax compliance happens directly inside the systems taxpayers use, rather than through separate reporting after the fact. Here's the practical effect: instead of each software house interpreting the CBS rules independently, many vendors can start from the same logic. That reduces the variation between systems that would otherwise produce different results for the same invoice.
The Receita Federal says the expected results are fewer doubts, less rework, and lower compliance costs. Those are reasonable goals, but they depend on how the code is used, which is where things get tricky.
Where the Common Advice Breaks Down
Most coverage of announcements like this stops at "open source means free and transparent." That's true as far as it goes, but it leads teams to a dangerous conclusion: that if they copy the calculator, their output is automatically correct.
Here's the catch. A hash confirms that the code you have matches the code that was published. It does not confirm that the calculator is right for your operation. A calculator implements rules for a defined set of inputs: the type of operation, the tax regime, the classification of the goods or services, and the parameters in force on the date of the transaction. If your ERP sends the calculator a wrong input, such as a misclassified service or an outdated rate table, the calculator will faithfully produce a wrong output, and the open code will show exactly why.
So the value of open source here is traceability, not automatic compliance. You still own the responsibility for the data you feed in and the rules that apply to your transactions.
What the Calculator Actually Does
The calculator "materializes" the calculation rules for the CBS and related taxes, which the release describes as a tool that embeds both the calculation method and the legal basis. The announcement says that companies can calculate reform taxes with a mechanism aligned to official rules, with the calculation memory and legal grounding built in.
Consider a mid-sized software house serving manufacturers across several Brazilian states. Its billing module currently applies tax logic that the team wrote from the legislation text and internal interpretations. When a rule changes, someone must find the change, update the logic, and test it against accounting results. Those steps take time, and the team may not see discrepancies until month-end reconciliation.
With the official calculator in a test environment, the same team can run a batch of historical invoices through both its own logic and the Receita's code, then compare the outputs line by line. Any difference points to either a bug in the company's logic or an input issue. That's a far faster debugging loop than reading statutes.
Here's where it gets interesting for engineering leads: the calculator can serve as a golden reference in your automated test suite. Feed it fixtures, store the expected outputs, and fail the build when your integration drifts from the official behavior.
Choosing the Right Repository
Picking the wrong repository is an easy mistake, and it can be expensive, since the regular regime and Simples Nacional follow different logic. The table below summarizes how each repository is likely to fit, based on the names in the release. Check the README and the official Portaria before relying on any scope assumption.
| Repository | Likely scope (from the name) | Best fit for | Watch-out |
|---|---|---|---|
calculadora-rtc-regime-regular | Calculation under the regular regime | Companies not under Simples Nacional, and ERPs serving them | Confirm each operation's regime before routing it here |
calculadora-rtc-simples-nacional | Calculation under Simples Nacional | Simples-registered businesses and vendors who serve them | Don't use it as a shortcut for regular-regime clients; test each regime separately |
calculadora-rtc-gerador-danfse | DANFSe document generation | Service invoicing (NFS-e) systems | Verify that the output layout matches what your municipality and the national standard require |
Most teams will need only one or two of these. A SaaS vendor serving both regimes will likely integrate the first two and test them against a shared fixture set.
Integrating Without Creating Future Debt
Once you've picked the right repository, the integration itself matters more than the download. A reasonable approach looks like this:
- Verify the downloaded code against the hashes recorded in Portaria Cotec nº 342 before anything else.
- Pin a specific version or commit in your dependency management, so an upstream change can't silently alter your billing results.
- Build a regression suite from real historical invoices, with expected outputs captured from the official calculator.
- Log the calculator's inputs and outputs in production, so you can reconstruct any disputed tax figure later.
The reason for pinning is simple. Tax logic changes with law, regulation, and technical notes. If you track the main branch without review, a legitimate update could change your numbers in the middle of a closing period. Treat each update the way you'd treat a tax-rate change: review it, test it, then release it.
This next part matters more than it looks. Many teams will want to wrap the calculator behind an internal API and call it from every system. That's a sound pattern, but it concentrates risk. If the wrapper fails silently or defaults to a wrong regime, you'll propagate errors across the business. Make failures loud.
Risks, Limits, and Open Questions
Honest assessment requires naming the limits. The publication is a significant step, but it doesn't settle every question.
First, the source material doesn't address how the calculator will track rule changes over time. You'll need to watch the official channels, including the Portarias published in the Diário Oficial da União, and check whether each repository's history keeps up.
Second, the announcement describes the goal of uniform interpretation, but a shared calculator can't resolve every ambiguity in the law. Where the legislation is unclear, the calculator's choice becomes the default for many systems at once. That's a benefit when the choice is correct and a concentrated risk when it isn't. Keep a documented process for flagging interpretation questions to your tax advisers.
Third, the release is in Portuguese. Developers outside Brazil should expect to work from the official documentation and may need translation support for technical notes and commit messages.
Most people stop here, and that's the mistake. Open code gives you a shared reference, but it doesn't transfer responsibility. Your tax position still depends on your data, your classifications, and your advisers' judgment.
Frequently Asked Questions
What is the Brazil tax calculator?
The Brazil tax calculator, called the Calculadora de Tributos, is a tool from Receita Federal that implements the calculation rules for the CBS and other taxes of the consumption tax reform. It's now published as open source on GitHub under the MIT license, so companies and software vendors can review and integrate its logic in their own systems.
how do I use the Brazil tax calculator in my software?
Start by downloading the appropriate repository and verifying its hashes against Portaria Cotec nº 342. Pin a specific version, then run it against historical invoices to compare results with your current logic. Integrate it behind an internal interface so failures are visible and easy to trace.
why did Receita Federal open source its tax calculator?
According to Receita Federal, the goal is to strengthen transparency, legal certainty, and predictability during the implementation of the new consumption taxes. Publishing the code lets companies and vendors use the same logic as the tax administration, which should reduce doubts, rework, and compliance costs.
does using the calculator guarantee my tax calculations are correct?
No. The calculator produces results from the inputs you provide, so wrong classifications, regimes, or parameters will still yield wrong outputs. A matching hash confirms the code is authentic, not that your data or interpretation is correct. Validate results against your advisers' judgment.
when should I use the regular regime repository instead of the Simples Nacional one?
Use the regular regime repository for companies taxed under the standard regime, and the Simples Nacional repository for businesses registered under that simplified regime. Because the two follow different logic, route each operation by its regime and test each one separately rather than treating either as a fallback for the other.
The single most useful step this week is to clone the regular-regime repository, verify its hashes against the Portaria, and run ten real invoices from your system through it. Note every mismatch, and the reasons behind it. Pass this to whoever on your team owns billing logic, because it's the fastest way to see how the Brazil tax calculator treats your transactions.