Yes, you can put a water heater in a bathroom, and millions of homes already do—but whether you should depends on the heater type, the room's size and ventilation, and local code. Electric tank and tankless units are the common candidates; gas units face much stricter rules about combustion air and flue routing, and some models are banned from bedrooms and bathrooms outright by plumbing and building codes.

The short version: an electric water heater in a bathroom closet or utility alcove is usually workable, a gas tankless unit on an exterior bathroom wall can be workable with the right clearances, and a gas tank-style heater in a small, closed bathroom is usually a bad idea even where it's technically legal. The rest of this guide explains the mechanisms behind those distinctions so you can judge your own space.

Why bathroom placement is a legitimate option

Bathrooms are among the most common places to find water heaters in apartments, townhouses, and older single-family homes. The reasons are practical rather than decorative. A heater in or beside the bathroom shortens the hot-water run to the shower and sink, which cuts the wait for hot water and reduces standby heat lost through long pipes. In small homes, the bathroom or an adjacent closet is often the only available spot.

Placement inside the room also keeps the heater out of a garage where temperatures can drop below freezing, and out of an attic where a leak can go unnoticed. Those are real advantages. The question is whether your specific heater and room satisfy the conditions that make indoor bathroom placement safe and legal.

The heater type drives most of the decision

The single most important factor isn't the bathroom—it's what kind of water heater you have. Gas and electric units behave very differently in a confined, humid, occupied space.

Criterion Electric tank Electric tankless Gas tank Gas tankless
Combustion air needed No No Yes, often large volumes Yes, via dedicated intake or outdoor air
Flue or vent routing None None Required, with draft and clearance rules Required, typically sealed or outdoor
Typical bathroom placement Closet, alcove, or wall Wall near point of use Rare and heavily restricted Exterior wall or dedicated vented space
Moisture sensitivity Moderate Moderate to high Moderate Moderate to high
Main code concern Clearances, electrical circuit, drain pan Circuit, clearances, moisture Carbon monoxide and venting Venting and air supply
Practical verdict Usually feasible Often feasible with care Usually discouraged Feasible in the right configuration

Read the table as a starting point, not a permit. The categories differ in ways that matter, so it's worth walking through each.

Electric tank heaters in a bathroom

An electric storage heater is the least constrained option. It needs no combustion air, no flue, and no gas line—just a properly sized electrical circuit, adequate clearance from walls and combustibles per the manufacturer's installation manual, and, ideally, a drain pan with a pipe to a safe discharge point. A closet opening onto the bathroom, an alcove beside the vanity, or a small mechanical chase are all plausible locations.

The limiting factors are physical and electrical. A 40- or 50-gallon electric tank is bulky—often roughly 4 to 5 feet tall and 20 to 24 inches in diameter—so the room or closet has to accommodate it plus service access. The unit also draws a substantial dedicated circuit, typically 240 volts and 30 amps for a 4,500-watt element (confirm the exact rating on the unit's nameplate).

You can't share that circuit with bathroom receptacles, and it usually can't run off the existing wiring.

The manual matters more than general rules here. Clearances, whether the unit is rated for closet installation, whether it needs a specific minimum air volume, and whether it can sit on a wood floor or needs a stand are all specified per model. If a unit is rated for a closet, the manual will say so and give the dimensions.

Electric tankless units

Electric tankless heaters shine in bathroom placement because they're small, wall-mounted, and installed near the point of use. A unit serving just a shower or a sink fits in a cabinet or on a wall and eliminates the long pipe run. Whole-house electric tankless models are larger and can be harder to fit, but point-of-use units are genuinely bathroom-friendly.

There are two important constraints. First, electric tankless units demand very high current for their output—whole-house models can require 60 to 120 amps or more, and even point-of-use units need a dedicated circuit sized to the unit. If the bathroom's electrical panel can't supply it, that's a project cost, not a placement problem.

Second, electronic components and moisture don't mix well; the unit needs to stay in a spot where splashing and steam won't reach it. A cabinet or an interior wall outside the shower zone is better than a spot directly over the tub.

The point-of-use question ties back to your hot-water habits. A small electric tankless unit serving a single shower may not keep up with a high-flow showerhead in cold incoming water, so check the unit's rated flow at your expected temperature rise before committing.

Gas tank heaters

Gas storage heaters are where bathroom placement gets genuinely risky. A gas water heater burns fuel and needs combustion air, and it exhausts combustion gases—including carbon monoxide—through a flue. In a small, tight bathroom, the air supply can be inadequate, and a backdrafting flue can spill combustion gases into the room. That's why many plumbing and mechanical codes restrict gas appliances in bathrooms and bedrooms.

The International Fuel Gas Code and the Uniform Plumbing Code, which many U.S. jurisdictions adopt with local amendments, require combustion air for fuel-burning appliances and impose special rules for appliances installed in bedrooms and bathrooms. In practice, a gas tank heater in a bathroom is uncommon and often prohibited outright, or permitted only with dedicated outdoor combustion air and a sealed vent.

This is not a place to improvise; the code edition your jurisdiction enforces and any local amendments control what is actually allowed.

The other gas-specific hazard is the ignition source. A standard atmospheric gas water heater can, in some failure modes, allow flammable vapors to reach the burner; manufacturers offer "flammable vapor ignition resistant" (FVIR) designs for that reason. A bathroom that holds aerosol sprays, cleaning solvents, and hair products is a poor location for an appliance with a standing pilot or open burner flame, even when the room is otherwise compliant.

Gas tankless units

Gas tankless heaters are often installed on exterior walls, including bathroom walls, with a sealed combustion system that draws outdoor air and vents exhaust directly outside. That configuration avoids the room air-volume problem and can be a legitimate way to serve a bathroom remotely. Indoor installation requires a proper vent kit, clearance from windows and doors per the manual, and often a dedicated air intake.

The trap is that "tankless" doesn't automatically mean "safe in a small room." A unit with an open combustion air requirement installed in a bathroom closet is essentially the same problem as a gas tank. The exact model's venting category, clearances, and air-supply requirements—not the product category—determine whether the location works.

What the codes actually regulate

Local codes vary, so treat the following as the issues your building department will want addressed rather than a checklist that guarantees approval. Plumbing and mechanical codes typically regulate:

  • Combustion air and venting for gas appliances, including appliance location rules and the prohibition of certain locations such as bedrooms and bathrooms unless specific conditions are met.
  • Relief valve discharge—the temperature-and-pressure relief valve needs a full-flow pipe routed to a safe discharge point; a floor drain, a pan drain, or an exterior discharge are common solutions.
  • Expansion and backflow—a closed system with a backflow preventer needs a thermal expansion tank.
  • Electrical disconnects and GFCI protection where applicable, especially for equipment near water.
  • Clearance and access—the installation manual's clearances to combustibles, plus enough room to service or replace the unit.

The details that tend to decide bathroom placements are combustion air, flue termination, and the relief-valve drain. Those are the items most likely to fail inspection, and they're also the ones most likely to matter for safety.

For the electrical specifics, the National Electrical Code addresses bathroom receptacles and water locations, but a fixed water heater is treated as a dedicated appliance. The applicable article and any local amendments, plus the manufacturer's instructions, determine the circuit, disconnect, and protection requirements. Your electrician or inspector should confirm.

Moisture, clearance, and access in a bathroom

Bathrooms are humid, and a water heater isn't a fan of persistent moisture. Steel tanks and electronic controls can corrode faster in a damp, poorly ventilated closet, and a leaking tank in a finished bathroom can damage flooring, drywall, and cabinetry before anyone notices.

Practical precautions:

  1. Put the heater in a closet or alcove, not open to the shower spray. Steam is less of an issue than direct splash and persistent condensation.
  2. Ventilate the closet. A louvered door or a transfer grille lets air move, which keeps humidity down and, for electric units, satisfies any air-volume requirement.
  3. Use a drain pan with a discharge. The pan must drain to a safe location; this is a code and insurance point, not an optional extra.
  4. Keep clearances from the manual. The unit needs space from walls, ceilings, and combustibles, and a contractor needs room to work on it.
  5. Plan for replacement. A 50-gallon tank on a closet shelf is far harder to remove and replace than a wall-mounted tankless unit. Measure the doorway, not just the space.

Iconic bathroom placement—tucked under a vanity or in a linen closet—works best when the unit is small and the room isn't a wet zone. A large tank in a small bathroom is a service-nightmare waiting to happen.

When a bathroom placement makes sense, and when it doesn't

The best fit is a point-of-use or small electric unit in a bathroom or adjacent closet, especially where the run to the shower is long or where no other location exists. In a compact apartment or a guest bath used intermittently, a small electric tank or tankless heater near the fixtures can be practical and efficient.

A bathroom placement is generally a poor choice for:

  • Gas storage heaters in small, tight bathrooms, where combustion air and venting are hard to satisfy and the code and carbon-monoxide risk push against it.
  • Whole-house units in undersized bathrooms, where the equipment can't be serviced or replaced without demolition.
  • Any location that can't drain a relief valve and fails to drain a leak, especially in finished rooms.
  • Spaces with no power capacity for a dedicated 240-volt circuit, unless you're willing to pay for the electrical work.

If you're weighing alternatives, an adjacent closet, a utility room, a garage (with freeze protection), or a basement is often easier and cheaper. Bathroom placement competes with those options rather than beating them outright.

Working through the decision for your own bathroom

Start by tagging your unit and reading the installation manual—the exact model number, not the generic product type. The manual tells you the clearances, the venting category for gas models, the air-supply requirement, the circuit rating, and whether the unit is approved for a closet or a bathroom. If the manual doesn't cover a bathroom location explicitly, check with the local building department and a licensed plumber.

Next, answer these in order:

  1. Gas or electric? If gas, confirm whether the model can be vented and whether the room can supply combustion air; if the closet is small and unvented, plan on a sealed-combustion or exterior installation, or move the unit.
  2. What's the electrical capacity? For electric units, find the circuit size the unit needs and whether the panel can supply it.
  3. Can you route the relief valve and a drain pan to a safe discharge? If not, the location fails a basic safety test regardless of code.
  4. Can the unit be removed and replaced? Measure the path, not just the floor space.
  5. What does the local code say? Permits for water heaters frequently include inspection of venting and relief-valve discharge, and gas work is typically restricted to licensed trades.

If those answers line up, an electric unit in a bathroom closet or a properly vented gas tankless unit on an exterior wall is a reasonable plan. If a gas tank heater in a small bathroom is the plan, get a licensed plumber's assessment before buying anything—the answer may be a different heater, a different location, or both.

Frequently Asked Questions

Is it safe to put a water heater in a bathroom?

For electric units in a ventilated closet with proper clearances and a drain pan, the main risks are moisture and leak damage, which careful placement manages. For gas units, the safety question is combustion air and venting, and a small bathroom often can't provide what the heater needs. Safety depends on the specific model and installation, and it's worth having a licensed professional confirm it.

Can a gas water heater go in a bathroom closet?

Sometimes, but only with a dedicated combustion air supply and a proper vent, and many codes restrict gas appliances in bathrooms. A closet in particular can leave too little air for safe combustion. Check the exact code in force locally and the heater's manual before assuming the closet works.

Do I need a permit to install a water heater in a bathroom?

Most jurisdictions require a permit for water heater replacement or relocation, often with an inspection of venting, relief-valve discharge, and electrical connections. Permit requirements are set locally; contact your building department before starting. Improper installation can also affect insurance coverage for water damage.

Can I put a tankless water heater in a bathroom?

Small electric point-of-use tankless units are commonly installed in or near bathrooms. Whole-house gas tankless units need a proper vent and combustion air; a bathroom interior wall can work if the unit is sealed-combustion or vented correctly. Confirm the unit's venting category and clearances against the installation manual.

How much space does a water heater need in a bathroom?

That depends on the model. Storage tanks are bulky—often about 2 feet in diameter and 4 to 5 feet tall for 40 to 50-gallon units—and need service clearance per the manual. Tankless units are much smaller but still need clearances and often a dedicated electrical circuit or vent. Read the manual's dimensions and clearance table before measuring.