Brazil's Receita Federal open-sources its tax reform calculator on GitHub under MIT

Three repositories, one ordinance and a set of recorded hashes: the calculation engine behind Brazil's consumption tax reform is now code any developer can clone, audit and ship.

Binary Buddies · 5 min read · 2 views
Dusk over the capital, code on the deskTwin towers and domed halls of a capital at dusk behind a desk where a paper tax tape curls into a screen of code and a branching commit graph whose first node glows.

On 12 November 2026, Brazil's Receita Federal signed Portaria Cotec nº 342, authorising the publication of the source code of its Calculadora de Tributos in public repositories on GitHub under the MIT licence. According to the Receita's announcement, it is the first time the federal tax authority has officially released a software project into a public, collaborative development environment.

The calculator is not a side project. It encodes the calculation rules for the CBS and the other taxes created by Brazil's consumption tax reform, and the move to those taxes means thousands of corporate systems for billing, management and compliance have to be adapted. Every software house that writes its own version of the rules is one more place where the interpretation can drift away from the one the tax administration applies.

The Receita's answer is to hand the market its own engine. Companies, developers and software vendors can now build in exactly the logic the administration uses, with the calculation trail and the legal basis attached to each result. The code was already downloadable from the Plataforma CBS since 2025. What is new is that it now lives in versioned open source repositories, with the hashes of their first published versions written into an official ordinance.

Key takeaways

  • Portaria Cotec 342, signed on 12 November 2026 and published in the Diário Oficial da União the next day, makes the Calculadora de Tributos the Receita Federal's first official open source project.
  • The code is split across three repositories: the regular regime, Simples Nacional, and a DANFSe generator.
  • The ordinance records the hashes of the initial versions, so anyone can check that what they cloned is what the Receita published.
  • The calculator is meant to be plugged into existing systems, not to replace them, and was built jointly by the Receita and Serpro.
  • MIT permits commercial use and modification but ships the code without warranty, so pin versions and track updates deliberately.

What Portaria Cotec 342 actually does

The ordinance was signed on 12 November 2026 and published the following day in the Diário Oficial da União, in the Seção 1 Extra B edition. It does two things a developer should care about. First, it formally authorises the publication of the Calculadora's source code in public GitHub repositories. This is not a team quietly pushing code to an account; it is an act of the tax authority, on the record. Second, it registers the hashes of the initial versions of those repositories, giving the first published code an official fingerprint.

The project is joint work between the Receita and Serpro, the federal government's data processing company. The Receita places the release inside the implementation of the Reforma Tributária do Consumo and names its aims as transparency, legal certainty and predictability in how the new consumption taxes are applied. It also lists the principles it says guide the reform's rollout: transparency, collaboration, interoperability, innovation and participation of the technology ecosystem in building the tools the transition needs.

  1. Code downloadable on the Plataforma CBS

    The Calculadora's code is available for download from the reform's own platform, outside any public development environment.

  2. Portaria Cotec 342 signed

    The ordinance authorises publication on GitHub under MIT and records the hashes of the initial repository versions.

  3. Published in the Diário Oficial

    The ordinance appears in the DOU, Seção 1, Extra B edition, making the release official.

Three repositories, three jobs

The code sits in three repositories under the ReceitaFederal organisation on GitHub:

The names describe the split. The regime regular is the standard taxation regime; Simples Nacional is Brazil's simplified regime for small businesses, which carries its own rules; and DANFSe is the auxiliary document of the electronic service invoice, the human-readable rendering of an NFS-e. A company in the regular regime and a small business under Simples Nacional will not necessarily pull in the same code, and a system that issues service invoices may want the document generator as well.

Before choosing, read each repository's README for its scope, inputs and build instructions. The split matters for integration planning: a billing product serving customers in both regimes may need to track two calculation repositories, each with its own history of changes.

The three Calculadora repositoriesThe Calculadora de Tributos is published as three ReceitaFederal repositories on GitHub, whose initial versions have hashes recorded in Portaria Cotec 342.ReceitaFederal on GitHubCalculadora de Tributosregime-regularRegular regimesimples-nacionalSimples Nacionalgerador-danfseDANFSe generatorInitial hashes in Portaria 342
One calculator, three repositories, and a single ordinance that fingerprints the first version of each.
Ministry blocks at nightA row of identical government office blocks after dark, windows lit, joined at their base by one glowing thread.

The same engine on both sides of the invoice

The Receita's own wording is precise: the Calculadora materialises the calculation rules of the CBS and the other reform taxes, and publishing it lets companies, developers and software vendors incorporate exactly the same logic the tax administration uses into their billing, management and compliance systems. The output is not a bare figure. The calculation trail, the memória de cálculo, and the legal basis come integrated with the result, so a disputed amount arrives with the steps that produced it and the rule behind each step.

The Receita ties this to the OECD's idea of Tax Administration 3.0, in which compliance happens directly inside the systems taxpayers already use rather than through filing and checking afterwards. A shared, official calculation component is the plumbing that model needs: if the rules run in the company's own invoicing software, they had better be the same rules the administration runs.

The Receita is explicit that the goal is not to replace the systems companies already have. The calculator is offered as an official component to integrate into existing products, raising the reliability and standardisation of tax calculations without asking anyone to rip out their ERP.

One rulebook, two sidesTaxpayer billing, ERP and compliance systems and the Receita Federal all use the same Calculadora code, which returns a calculation trail and the legal basis.One rulebook, two sidesBilling systemERP and managementCompliance toolCalculadoraMIT, on GitHubTax administrationReceita FederalCalculation trailLegal basis cited
The point is the middle box: taxpayers' systems and the administration run the same calculation code, and every result carries its trail and its legal basis.

From a download link to a repository

The code itself is not new. It has been available for download on the Plataforma CBS since 2025. The Receita describes the move to GitHub as an important step because it takes the calculator into the main environment the global software community works in, and because a repository changes how a team consumes the code over time.

For software houses and in-house technology teams, the Receita singles out three practical gains: it becomes easier to follow how the Calculadora evolves, to control which version is in use, and to fold updates into existing development and continuous integration pipelines. In a reform rolled out over a transition period, that is the part that matters. A one-off download answers the question of what the rules are today; a repository with history answers what changed, when, and in which commit.

Plataforma CBS download

The route that existed before the ordinance.

  • Available since 2025
  • Obtained from the reform's own platform
  • Same calculator code, outside a public development environment

GitHub repositories

Formalised by Portaria Cotec 342.

  • MIT licence
  • Version history to follow changes
  • Updates can feed continuous integration
  • Initial versions fingerprinted by hashes in the ordinance
3public repositories on GitHub
2025code first downloadable on Plataforma CBS
342number of the authorising ordinance

Checking that the code is the code

Tax calculation code is an obvious target: a fork that quietly changes one rate, or a mirror that lags the official version, could put wrong numbers on thousands of invoices. The Receita's defence is unusually concrete for a government release. Portaria Cotec 342 registers the hashes of the initial versions of the repositories, so the authenticity and integrity of the published code can be checked against a document in the Diário Oficial rather than against whatever a web page says.

That only works if someone actually does the check. Here is a sensible routine for a team taking the code into a product:

  1. Clone the repository you need

    Take it from the ReceitaFederal organisation itself, not from a mirror or a fork, and repeat for each of the three repositories you depend on.

  2. Find the initial version

    List the history oldest first and note the identifier of the first published version, as in the commands below.

  3. Compare against the ordinance

    Open Portaria Cotec 342 in the DOU of 13 November 2026, Seção 1, Extra B. Check whether each recorded hash identifies a commit or a file digest, and compare like with like.

  4. Pin, do not float

    Reference a specific commit or tag in your build, and move to a newer one deliberately, after reading what changed.

git clone https://github.com/ReceitaFederal/calculadora-rtc-regime-regular.git
cd calculadora-rtc-regime-regular
git log --reverse --format='%H %ad' | head -n 1
Verifying an initial versionThe hash recorded in Portaria Cotec 342 is compared with the hash computed from the GitHub repository; a match verifies the code, a mismatch means do not ship.Verifying an initial versionPortaria Cotec 342GitHub repositoryHash on recordHash you computeCompareMatch: code verifiedMismatch: do not ship
The ordinance turns the first published version into something you can check against an official record, not just trust.
A tape of figures and a chain of versionsAt dawn a long paper tape of figures lies across a table while a chain of linked version markers floats above it, the first one glowing.

What the MIT licence does and does not promise

The Receita chose MIT, which it describes as one of the most widely used licences for open source code in the world. It is about as permissive as licences get: anyone may use, copy, modify, merge, publish, distribute, sublicense and sell the software, including inside closed commercial products, on the single condition that the copyright and permission notice travels with it. For a vendor that wants to embed the official engine in a paid billing product, there is no copyleft clause forcing it to open its own code.

There is a tension worth naming. The Receita presents the calculator as a source of legal certainty and safer implementation of the tax rules. The MIT text, meanwhile, provides the software "as is", without warranty of any kind, and disclaims the authors' liability. Both things can be true at once: the ordinance gives the code official standing as the administration's own logic, while the licence governs it as a piece of software. But nobody should read MIT as a guarantee that a calculation is right for their case, or as a statement about who answers for a wrong one.

The practical consequence is about process, not law. If the value of the component is that it matches what the administration runs, a team that lets its copy fall several versions behind has thrown that value away.

Who gains, and who has to rethink

The Receita lists the benefits it expects for companies and managers:

  • Greater security in implementing the tax rules
  • Lower development and maintenance costs
  • Transparency about how the taxes are calculated
  • Uniform interpretation of the rules
  • Easier integration with systems the market already uses

The expected result, in its words, is fewer doubts, less rework and lower compliance costs. For a company running an in-house system, that is a straightforward win: an auditable, interoperable component it did not have to write. For ERP integrators, whether they work on Odoo localisations, large commercial suites or bespoke platforms, the question is how cleanly the component can be wrapped. That depends on the language, interfaces and packaging in each repository, which are worth checking in the code before committing to an architecture.

The harder conversation belongs to vendors whose product is the tax engine itself. When the authority publishes its own calculation logic, free and permissively licensed, correctness of the core arithmetic stops being a differentiator. One reading is that this squeezes them; another is that it frees them to compete on what customers actually struggle with, such as integration, data quality, reporting and support, while sharing a common base for the rules. Both views will be tested as the transition runs.

Limits and what to watch next

The ordinance fingerprints the initial versions of the repositories. The reform's rules will keep moving through the transition, so the open question is how later versions will be published and authenticated, and how quickly the official code will follow changes in the rules. Teams should watch the repositories' release history and any further ordinances before assuming every future commit carries the same official weight as the first.

Publishing on a collaborative platform also raises the question of participation. Whether the Receita and Serpro accept issues and pull requests, and how they handle them, is set by each repository's own contribution settings and guidance, so check those before planning to upstream a fix. And as the Receita's first official open source project, this one may set the pattern for whatever it publishes next.

Is the Calculadora de Tributos code new?

No. It has been downloadable from the Plataforma CBS since 2025. What changed in November 2026 is its official publication on GitHub under MIT, with the initial versions' hashes recorded in Portaria Cotec 342.

Can I use it inside commercial software?

Yes. The MIT licence allows commercial use, modification and redistribution, provided the copyright and permission notice is kept. It comes without warranty.

How do I know a copy has not been tampered with?

Compare the hash of the initial version you cloned with the one registered in Portaria Cotec 342, published in the DOU of 13 November 2026, Seção 1, Extra B.

Does it replace my ERP's tax module?

That is not the intent. The Receita describes it as an official component to integrate into existing systems, not a replacement for them.

Which taxes does it calculate?

The CBS and the other taxes introduced by Brazil's consumption tax reform, with the calculation trail and legal basis integrated into the result.

This article draws on Open Source Alternatives to Reflector? and answers to it (1, 2), on the Stack Exchange network, licensed under CC BY-SA 4.0.

  • #Calculadora de Tributos
  • #MIT license
  • #Open Source
  • #Receita Federal
  • #Reforma Tributária
  • #github

Comments

Add a comment
Sign in with Google to join the conversation