Defragmenting Democracy

By Leili Slutz

A citizen’s access to the law determines her ability to self-govern. Here’s how you can help.

Late one autumn in 2013, San Francisco resident Gary Rabkin sat at his computer browsing through his city’s legal code online. Gary, an attorney with a love for bikes, visited, a site providing free and easy access to the laws that shape his city. There, Gary happened upon a law prohibiting residents from storing bicycles in their garages. He left a comment questioning its utility, a comment which made it all the way to Gary’s representative, Supervisor Mark Farrell. On July 15, 2014, the Board of Supervisors passed an amendment solving Gary’s problem.

In the age of 3D printers, virtual museum tours, and civilian-controlled drones, Gary’s story might seem insignificant. But when it comes to how citizens interact with the law, the source code of their democracy, his story serves as an exciting leap forward. is a website created by The OpenGov Foundation, a 501(c)(3) non-profit. Our mission is to open up laws, legislation, and lawmaking processes so that as many people as possible can see, understand, and shape the policies that affect their lives. In many cities across the nation, laws and legislation are locked in printed volumes or downloadable PDFs, behind paywalls, copyright restrictions, and user agreements. We realize that lawmaking is messy, complicated business, but we believe that everyone deserves the ability to access their country’s laws (and lawmaking processes). In essence, we fight for legal access.

We’ve discovered that numerous governments share similar challenges and uncertainties with regard to opening up their lawmaking processes. That’s why we’re committed to growing the free law movement, guided by those interested in opening up their laws and legislation online so that we can share resources and expertise. In this article we’ll break down everything we mean when we say “open” laws and legislative data: what it is, why it’s important, how it happens, and how anyone interested can join our ranks.

The San Francisco bicycle law is just one small example of what’s possible when we open up legal code on the Internet. Imagine a world where citizens can easily go online, identify policies that aren’t working, and flag them for legislators; a world where policymakers can quickly compare laws between locations by topic; a world where citizens can easily find the laws they’re required to follow, and share that information with others. That’s the world we’re fighting for.

Many governments have enacted open data policies or have them in the works—yet these policies tend to leave out laws and legislation.

A conceptual sketch of someone staring at a notebook of pages flying away.

The blueprint of democracy

The legal code of every political community—from the smallest town to the United States itself—is formed as a blueprint, outlining all the ways in which government functions. Legal code dictates how employers should treat their employees and where people should park their cars. If someone wants to open a business, fight a negligent landlord, demand bike lanes, or make it easier for residents to build community gardens, they need to know what the law says. But it’s often surprisingly difficult to access this information.

Codification is the process of integrating new laws into an existing body of legal code; it’s complicated business and requires expertise. As a consequence, municipalities often outsource codification to vendors such as the Municipal Code Corporation or LexisNexis. After crafting the law, most codifiers—with the notable exception of American Legal Publishing Corporation—copyright the structure they give to it (i.e., the titles and numbers they give to each section and subsection of the code). But copyrighting the law’s structure also makes it difficult for everyone else to reuse it1.

The OpenGov Foundation believes that everyone should have access to the laws by which they must abide as well as a say in their community’s lawmaking process2. That’s why we’ve made it our mission to help municipalities and states open up their legal code (as well as their legislative data), making it publicly available in a way that’s cost and restriction-free, up-to-date, well-formatted, machine-readable3, and available for bulk download4. The next section sheds some light on how we did this for the City of San Francisco while creating

The State Decoded

In theory, opening the law involves little more than posting a municipality’s legal code (which should be in the public domain) online. In practice, it’s a bit more complicated than that. That’s partly because everyone involved—citizens, government employees, codifiers, and developers—has a different relationship with legal data. It’s also because securing access to a municipality’s legal code can be a non-trivial endeavor.

To be most useful to citizens, legal data should be properly formatted, searchable by keyword, and presented in clear sections and subsections. To be most useful to government employees, legal data should be up-to-date and easily maintained. Finally, to be most useful to developers, legal data should be accessible via an API. Our organization has dealt with this problem for a while now, which is why we’ve chosen to contribute to and deploy open source software called the State Decoded. Originally created by Waldo Jaquith, the State Decoded is an online legal library designed to offer citizens, government employees, and developers everything they might want with regard to open legal code—and then some.

The State Decoded user interface presents sections of the law on individual pages so the complicated information is easier for humans to digest, link to, and share.

But utilizing the State Decoded is only half the battle. Oftentimes one of the hardest parts we encounter in helping municipalities open up their legal code is securing access to their legal data. We’ve found that the best way to do this is to directly partner with the people who produce a municipality’s legal code (or those who have the right to distribute it). And the best way to do that? Sleuthing, of course!

The steps we take often look something like this:

  1. The OpenGov Foundation starts by going to a municipality’s website—say,—and looking through their legal code for information related to how they operate. In San Francisco it’s detailed in Chapter 8 of the Administrative Code.
  2. Next, we read through the law to figure out which part of government is responsible for producing and publishing the law. In San Francisco, that responsibility rests with the Clerk of their legislature, called the Board of Supervisors.
  3. Finally we try to determine how the government is required to present its laws to the public in order to obtain it ourselves. This requirement varies between locations. In San Francisco—thanks to a motion from Supervisor Mark Farrell—the Clerk is exploring ways to release all written resolutions, ordinances, and motions (along with relevant metadata) on the Board’s website in a machine-readable format. In Cambridge, Massachusetts, on the other hand, the City Clerk is required to publish and place laws in a three-ring binder available for pickup by interested citizens. They’re working on that.

It should be pretty clear by now that we can receive legal code in widely varying formats. This ultimately leaves us having to wrangle data into a format that can be used by the State Decoded software. More information about this process is available on the State Decoded GitHub page, but in San Francisco we hosted an event called a data-a-thon. We started by creating a repository on GitHub and uploading a plaintext version of San Francisco’s legal code. Then we asked participants to parse the code into separate files, one for each section. This was presented as a homework assignment to be completed before we collaboratively built

The last step in this process involved setting up the State Decoded on a server and providing it with access to San Francisco’s legal data. This is a pretty involved process and interested readers should take a look at the setup instructions for the State Decoded and information on the State Decoded’s parser. This is everything you’ll need to create a site like the one we made for the City of San Francisco.

On sustainability

After choosing to set up an instance of the State Decoded, the next questions a municipality should address are ones of sustainability and governance: how will a municipality keep the digital version of its legal code up to date? And how will they respond to comments that concerned citizens like Gary Rabkin will inevitably make?

You can probably see where this is going. Setting up The State Decoded is more than setting up a website; it’s the start of a conversation. For that reason, the OpenGov Foundation only creates the State Decoded sites in close collaboration with governments who choose to work with us.

Some governments release municipal code updates every month; some only once or twice a year. As the State Decoded sites are most helpful when the data is up to date, the OpenGov Foundation has formed a partnership with American Legal Publishing Corporation (one of the codifiers mentioned above) that makes it easier to access that updated data5. Because San Francisco outsources its codification to American Legal, our relationship with this organization plays a crucial role in our ability to keep up to date. Generally speaking, each municipality will need to uniquely determine how to update the digital copy of their legal code.

A conceptual sketch of three hands coming together to write a document.

The Free Law Founders

The open law movement is relatively nascent. As such, we’re building a national coalition called the Free Law Founders (FLF) that brings together government workers, elected officials, policy experts, and civic technologists working to modernize the lawmaking process in governments across the US. The FLF exists to share resources and expertise around our goal. Our first major initiative is to have FLF-member locations pass policies requiring the timely release of open legal code and legislation online.

We help our FLF partners by researching the current policy and best next steps for their location. We discuss these policies with other FLF members so that everyone can learn from the process or offer their expertise.

Many governments have enacted open data policies or have them in the works—yet these policies tend to leave out laws and legislation. In some cases the policy’s definition of “data” excludes written text. In other cases, the policy doesn’t extend to the entity in charge of legal code and legislation. Where there are open data policies in existence, the OpenGov Foundation goes through the language carefully to see if legal code and legislation fit under the scope of the policy; if it does, we let our partners in government know, and they approach those in charge of implementing the policy and work from there. If the policy doesn’t include legal code and legislation, our government partners determine the best next steps, which sometimes involves legislation.

Once legislators are onboard we point them to the Free Law Founders, and to model policy documents from Free Law Founders members like San Francisco Supervisor Mark Farrell and New York City Council Member Ben Kallos. Free Law Founders members can provide valuable input and advice during this stage. We emphasize the requirement of timely, well-formatted, machine-readable bulk downloads of legal code and legislative data.

Reach out to your lawmakers and civic tech communities, educate them, and bring them into the fight—and it is a fight.

Once the laws are passed, it’s up to that government as to how they want to implement the requirements. We recommend hiring a developer and putting up an open instance of the State Decoded, as detailed above. But we’re happy to provide technical guidance along the way.

Collaborative lawmaking

A big part of our work involves getting our hands on data sets and getting sign-offs from the right people. We spend a lot of time researching, educating, communicating, negotiating, and making connections—and we can always use help. We formed the FLF to support the efforts of anyone interested in taking up the fight. Join us today to tap into our support network and start opening up the laws and legislation of your government.

If you have technical skills, set up an instance of the State Decoded for your locality. While many governments have the will to make the law more accessible, they often lack the way. Once the legal code is open, we encourage innovation such as building new interfaces and visualization tools on top of the law, or looking for interesting trends in the data.

If you have skills in community organization, advocacy, or research, determine the state of affairs of your government. Reach out to your lawmakers and civic tech communities, educate them, and bring them into the fight—and it is a fight. The future we envision isn’t going to come without hard work and ingenuity. The OpenGov Foundation is working to provide legal advocates around the world with the best tools and advice we have available. I invite you to join us.


  1. It’s difficult to overstate how cumbersome this can make it for citizens looking to access the law. Imagine if the San Francisco Code weren’t split into sections or subsections. It would take forever to find the information you need. Without clear organization, the law isn’t very useful—to humans or machines.

    If vendors choose to put the law online, they typically add user agreements, provide a read-only environment, or even require payment for access. In some municipalities, the law isn’t yet online, so the only way to find information is to leaf through giant volumes at the local library or to hire a lawyer.

  2. That’s possible with our open source legislative crowdsourcing tool, Madison. Madison requires open, machine-readable legislation as well—a challenge we’re continuing to tackle. That’s a subject for another day.

  3. At the risk of sounding tautological: machine-readable information is information that can be parsed by a computer. Compare that with a document saved as PDF. Computers basically see PDFs as giant image files; they can’t separate or do anything with them. Information saved as XML, however, can be “read” (and analyzed, manipulated, etc.).

    XML and JSON are good examples of machine-readable formats. For legal code, we prefer USLM.

  4. Sticking a PDF online is insufficient, for example, because no one wants to spend hours scanning through a giant document just to find the one subsection they need—especially when they’re not 100% sure what they’re looking for in the first place! Modern citizens deserve interfaces like

  5. Every time American Legal publishes a new version of the code for one of their partner cities, they also post the data on an FTP server so we can pull the new laws into State Decoded sites’ parsers.


Leili SlutzLeili Slutz is the Operations Architect at The OpenGov Foundation, where she works with community members, government workers, and civic innovators to upgrade America’s lawmaking processes for the 21st Century. / @LeiliSlutz