What is Rules As Code?
Legislation and rules can be extremely difficult to understand and interpret. They often use complex legalese language and include multiple references to other legislation/policy. This means users may need to read many documents to understand one ‘rule’. Rules As Code (RaC) turns legislation, regulations and policies into machine-readable code.
By coding the law/rules, you can transform legislation and rules into simple-to-use digital experiences. This innovative approach can be used for things like eligibility checking, compliance checking and creating digital policy twins for policy modelling.
The encoded legislation exists alongside the natural language version (it does not replace it) to facilitate digital service delivery.
Why Rules As Code?
Turning rules into machine-readable code provides many benefits for government, citizens and broader society. RaC helps to reduce ambiguity, reduces the difficulty of interpretation and therefore makes it easier for citizens and organisations to comply with the rules. Importantly, it also leads to greater transparency in rules.
Turning legislation into code can also identify gaps and inconsistencies in the original legislation.
For a full list of benefits, see the OECD’s Cracking the code: Rulemaking for humans and machines (Opens in a new tab/window)(p.39 includes a benefits table).
What type of legislation can be coded?
In general, rules (legislation, regulation or policy) that are prescriptive rather than discretionary are best suited for coding. However, it’s worth mentioning that the New Zealand Service Innovation lab found(Opens in a new tab/window) that discretionary rules can be written in code too.
In terms of focus, because the process of transforming existing legislation into code can be complex and time consuming, focusing on rules that can reduce the burden on citizens, create service efficiencies or automate processes will have the most immediate impact.
When to code rules?
While most rules will be coded after the legislation is written, writing RaC alongside the written legislation (i.e. at the same time) is the most efficient approach and can significantly improve the quality of the written legislation.
Who’s using Rules As Code?
Many governments around the world are exploring and implementing RaC — although it’s still definitely an emerging field.
France was an early adopter, creating the open source OpenFisca(Opens in a new tab/window) platform that can be used to support and create RaC. See the Salsa Digital article 'What is OpenFisca?' for more information(Opens in a new tab/window).
New Zealand and Canada(Opens in a new tab/window) are also active in this space. Rules As Code is part of NZ’s Better Rules program(Opens in a new tab/window), which brings a new approach to policy and legislation. RaC was also used in creating NZ’s SmartStart(Opens in a new tab/window), a portal for NZ parents that includes birth registration.
In Australia, the Australian Department of Finance is bringing Rules as Code to its Federal Government(Opens in a new tab/window) via GovCMS, a whole-of-government platform and content management system. In 2024, GovCMS launched a 'sandpit program' for government agencies to experiment with Rules as Code. In 2025, work towards a production-ready platform began.
You can find more resources on the resources page of the RaC Guild(Opens in a new tab/window).