A home battery is one of the few purchases where the physical envelope, not the product, sets the ceiling. You can want 100 kilowatt-hours in the mechanical room. The code has an opinion about that, and the opinion is older than the quote you are holding.
The provisions live in Section R328 of the International Residential Code, which is the model code that most American jurisdictions adopt, amend and then enforce as local law. The section is about a page long. Here is what it actually says, and then the part that matters more: why the copy on your desk may not be the copy your inspector is holding.
The numbers
Section R328.5, energy ratings, in the 2021 edition:
Individual ESS units shall have a maximum rating of 20 kWh. The aggregate rating of the ESS shall not exceed: 1. 40 kWh within utility closets, basements and storage or utility spaces. 2. 80 kWh in attached or detached garages and detached accessory structures. 3. 80 kWh on exterior walls. 4. 80 kWh outdoors on the ground.
ESS is an energy storage system. So: 20 kWh is the largest single unit, and where you put it decides whether your total is capped at 40 or 80. An indoor utility space gets half the allowance of a garage or an outdoor wall, which is the code expressing, in numbers rather than prose, how it feels about stored energy inside the conditioned envelope.
The sentence immediately after is the one that gets omitted from summaries, and it is the expensive one:
ESS installations exceeding the permitted individual or aggregate ratings shall be installed in accordance with Section 1207 of the International Fire Code.
Exceed the cap and you have not broken a rule, you have changed rulebooks. Section 1207 of the fire code is where commercial and utility installations live, with the analysis, separation and fire-protection requirements that come with them. An owner who wants a large bank at a residence is not asking for a bigger battery. They are asking for a different permit, a different design and a different cost basis.
The places
Section R328.4 is a closed list. ESS "shall be installed only in the following locations": detached garages and detached accessory structures; attached garages separated from the living space per the fire-separation section; outdoors or on the exterior side of exterior walls "located not less than 3 feet (914 mm) from doors and windows directly entering the dwelling unit"; and enclosed utility closets, basements, storage or utility spaces with finished or noncombustible walls and ceilings. That last one carries a construction detail people miss: unfinished wood-framed walls and ceilings in that space need "not less than 5/8-inch (15.9 mm) Type X gypsum wallboard."
Then the hard stop:
ESS shall not be installed in sleeping rooms, or closets or spaces opening directly into sleeping rooms.
Not the bedroom, and not the closet that opens into it. If your quiet, tidy plan was a cabinet in the primary suite because the inverter hum bothers you in the garage, that plan is not permitted by the model code, and this is the kind of thing that gets discovered at inspection rather than at design.
The three-foot rule has a door in it
Spacing, Section R328.3.1:
Individual units shall be separated from each other by not less than 3 feet (914 mm) except where smaller separation distances are documented to be adequate based on large-scale fire testing complying with Section 1207.1.5 of the International Fire Code.
Read the exception carefully, because it is not what people assume. The code does not ask whether the product is certified for closer spacing. It asks whether smaller distances are documented to be adequate based on large-scale fire testing. That is a test report, evaluated for your installation, not a logo on a box.
This is the practical face of something I wrote about in Report 101, on why nothing is "UL 9540A certified". UL 9540A is a test method for thermal runaway fire propagation. It produces data. It is not a pass, and it is not a certification, which is exactly why the code phrases the exception in terms of documentation rather than listing. UL's own one-page summary of the residential requirements says the same thing in plainer words: three-foot separation, "Except where smaller separation distances are documented based on UL 9540A Test Report."
If an installer tells you units can sit shoulder to shoulder, the correct response is not skepticism about the product. It is a request for the document, because the code has already told you the document is the thing that matters.
The exceptions most summaries drop
Section R328.1, the scope statement, carries two exceptions that almost never survive into a blog post:
Exceptions: 1. ESS listed and labeled in accordance with UL 9540 and marked "For use in residential dwelling units" where installed in accordance with the manufacturer's instructions and NFPA 70. 2. ESS less than 1 kWh (3.6 megajoules).
The second is housekeeping, keeping small devices out of scope. The first is structural. A unit listed to UL 9540 and marked for use in residential dwelling units, installed per its instructions and the electrical code, is addressed through its listing and its instructions rather than through the rest of the section. Which means two products with identical kilowatt-hours can face different requirements, based on a marking and an installation manual rather than on chemistry.
That is worth knowing before you argue with a plan reviewer, in either direction. It is also worth knowing that the manufacturer's instructions become enforceable in that path, so "per the instructions" is not a formality. It is the requirement.
Which rulebook actually binds you
Here is the part that is genuinely useful and that no product page will tell you: the model code is not the law. Your jurisdiction adopts an edition, amends it, and enforces that. Same section number, different text.
Two documented examples, from opposite coasts. Washington's state building code council, working through correlation changes to its adopted residential code, struck the model code's exception in R328.2 that would have allowed approved repurposed unlisted electric-vehicle batteries outdoors or in detached sheds at least five feet from exterior walls, property lines and public ways. In the state's markup, that entire exception is shown as deleted. If you were planning a second-life pack in a shed, the model code contemplated it and that state's adoption did not.
California went the other way and added. Shasta County's residential ESS handout, citing the California Residential Code, tells applicants that systems with the potential to emit toxic gases shall not be installed within dwellings or attached garages, a restriction I do not find in the 2021 model text, and points to sections through R328.12 where the model code's last section is R328.11. California also runs its own electrical code section for who may install one.
So the answer to "what does the code say about my battery" is: it depends which code, which edition, and which amendments, and the only authoritative copy is the one your building department enforces. That is not a disclaimer. It is the actual finding, and it is why a national marketing page cannot answer the question for your address.
Why this beat cares
I help design the AI battery-cycling systems for a veteran-owned (HUBZone) energy-storage integrator. I do not own that company and earn nothing from this link. Full policy here.
The reason siting rules show up in the software side of that work is that they set the shape of the asset before any controller sees it. Aggregate caps and separation distances determine how many units go where, and that determines thermal behavior, which determines how the cells age under a given cycling strategy. Four units spread along an exterior wall and four units packed into a utility room are not the same battery, even with the same nameplate, and the difference is written in a building code rather than a datasheet. I came to this expecting the interesting constraints to be electrical. A lot of them are architectural.
There is also a plain planning point for owners. If you want meaningful whole-home backup at a large property, the caps mean the conversation starts at siting, not at product selection. Deciding late that everything lives in the mechanical room is how a project meets the 40 kWh line and gets redesigned.
What I could not confirm
The code text quoted here is the 2021 International Residential Code, read through two official reproductions rather than a paid copy of the code itself. The full section text came from a Florida municipal permit handout that reprints 2021 IRC R328 verbatim, and independently from Washington's state code-council correlation document, which reprints the same section with that state's amendments marked. The two agree word for word on everything I quote. I could not open the publisher's own copy, which sits behind a subscription, and I did not open the 2024 edition, so I make no claim about what changed after 2021.
I likewise did not open NFPA 855, the installation standard for stationary energy storage, or the International Fire Code sections referenced above. That leaves one loose end I want to name rather than paper over: UL's summary sheet, which cites both IRC R328 and NFPA 855 Chapter 15, states that aggregate ratings may also be exceeded where documented by a UL 9540A test report. The 2021 IRC text I read contains that exception for spacing but not for the ratings, where it instead routes you to fire code Section 1207. I could not determine from the documents I opened which standard carries that additional allowance, so treat the aggregate caps as I have quoted them and ask your jurisdiction.
The Washington and California examples are real and sourced, but they are two data points chosen to demonstrate that amendments exist, not a survey. I have not checked any other state, and neither example is legal advice about that state today. The county handout is a plain-language summary by a building department, not code text, and I have described it as such.
Nothing here is engineering for your site. Listings, editions and local amendments change, and the authority having jurisdiction decides. This is not my research: the code is the International Code Council's, the test method is UL's, and I am reporting what the documents say.
The signal
Storage marketing sells kilowatt-hours. Residential code sells locations, and it prices them: 40 kWh if you want it inside, 80 kWh if it hangs on a wall or sits in a garage, 20 kWh per unit either way, three feet apart unless somebody has a fire test report that says otherwise, never in a bedroom.
Those are not obstacles a good installer routes around. They are the design, and they are decided at the site walk, before anyone quotes a battery. The number that ends up governing your project is not on the spec sheet. It is the edition of the code your jurisdiction adopted, and the amendments it made on the way.
Sources
- Town of Davie, Florida, Building Division, "Energy Storage Systems (ESS) Electrical Solar Permits," permit handout reprinting 2021 International Residential Code Section R328. (PRIMARY reproduction, PDF opened and read locally. Source for the verbatim text of R328.1 exceptions, R328.2 equipment listings and its repurposed-EV-battery exception, R328.3 installation, R328.3.1 spacing, R328.4 locations and the sleeping-room prohibition, R328.5 energy ratings and the referral to International Fire Code Section 1207, R328.6 electrical installation, R328.7 fire detection, and R328.8 through R328.11 covering impact protection, ventilation, electric-vehicle use, and documentation and labeling. The model section as reprinted here ends at R328.11.)
- Washington State Building Code Council, "IRC Proposed Correlation Changes," Section R328 Energy Storage Systems, posted January 2023. (PRIMARY, PDF opened and read locally. Independent reproduction of the same R328 text, with the state's amendments shown in strike markup. Used to corroborate the model text word for word, and as the source for the deletion of the R328.2 exception permitting approved repurposed unlisted electric-vehicle battery systems outdoors or in detached sheds not less than 5 feet from exterior walls, property lines and public ways.)
- UL Solutions, "2021 Residential ESS Requirements," code-authorities summary sheet, August 2021. (PRIMARY from the listing body, PDF opened and read locally. Cites International Residential Code Section R328 and NFPA 855 Chapter 15. Source for the quoted phrase "Except where smaller separation distances are documented based on UL 9540A Test Report," for the 20 kWh per unit and 40/80 kWh aggregate summary, and for the additional statement, not found in the IRC text read for this report, that larger aggregate kWh ratings may be documented based on a UL 9540A test report.)
- Shasta County, California, Department of Resource Management, Building Division, "Residential Energy Storage Systems Handout," citing California Residential Code R328 and California Electrical Code 706. (Official county handout, PDF opened and read locally. Plain-language summary rather than code text. Source for the California-specific statement that ESS with the potential to emit toxic gases shall not be installed within dwellings or attached garages, for the citation range CRC R328.7-12 extending past the model code's R328.11, and for the CEC 706.3 requirement that an ESS be installed by a qualified person.)
- Onur Oncer, "There is no such thing as UL 9540A certified," The Signal Report 101, and "What a battery cost per kWh actually includes," The Signal Report 132. (Earlier reports in this beat on the test method the spacing exception depends on, and on what a headline storage number leaves out.)
Scope note: this report quotes model residential code provisions as reproduced in official jurisdiction documents, and describes two examples of local amendment. It is not legal advice, not an engineering specification, and not a statement about the code in force at any particular address. Editions and amendments change and the authority having jurisdiction governs. No product, manufacturer or installer is assessed or recommended here. Disclosure: the author helps design AI battery-cycling systems for a veteran-owned energy-storage integrator, as stated in the body of this report, and does not own that company.
Onur Oncer
U.S. Army combat veteran (Counter-IED / Electronic Warfare), peer-reviewed researcher in microwave spectroscopy, and founder & CEO of Shroombiosis. Consults on laboratory operations, AI, and supplement formulation.