No one likes to run out of hot water when taking a bath, but an oversized unit will cost you more and will not provide the energy savings you seek. Sizing is important, and the methods to calculate the right size are different, according to the type of water heater.
An under-sized tankless unit will struggle to keep up with demand in the winter, particularly in places where groundwater temperatures are very low.
Likewise, tank storage water heaters should provide enough storage volume to meet demand during peak-demand periods.
Oversized Water Heaters
The size of your water heater should not greatly exceed your hot water requirements. That's important for energy savings. An oversized storage unit will result in unnecessary standby losses.
Sizing a storage Water Heater
All manufacturers publish the First Hour Rating (FHR) of their storage water heaters (say, 40 gallons/150 liters) - the best way to estimate the right size of such a heater.
When buying look for a water heater that meets your own First Hour Rating.
The best size for a water heater varies with the size of your family, schedules and bath habits. Most single-family homes have 40-50 gallons (150-190 liters) storage tanks, but that's just an average. To know your First Hour Rating you have to calculate how much hot water you need for showers/baths, dishwashers, clothes washers, food preparation or other possible uses in your peak hour demand.
An example: supposing that your peak hour involves two baths (15 gallons/57 liters each), dishwashing (15 gallons/57 liters) and food preparation (5 gallons/19 liters), then you need a 2x15+15+5=50 gallons water heater (about 133 liters). That's your First Hour Rating.
And once you know your First Hour Rating, you just have to look for a water heater that falls within a couple of gallons of it.
Gas and electric water heaters sizing
Gas storage-tank water heaters can be slightly smaller than electric units. A 50 gallon electric water heater can be replaced by, say, a 40 gallon gas water heater.
Tankless water heaters
Tankless water heaters provide continuous hot water, which means that their capacity is measured in Gallons per Minute (or Liters per Minute) of hot water.
Many standard tankless water heaters have a capacity of 2-3 Gallons of Water per Minute (8-12 Liters per Minute), but that may not be enough for more than one shower at a time.
To run two hot showers at the same time, or perhaps a dishwasher or washing machine while the shower is running, you may need a 4-6 GPM (15-23 Liters per Minute) water heater.
To estimate the size of a tankless water heater in a more precise way, you need to know your GPM/LPM needs. That is: you must consider the simultaneous uses of hot water; if you want a water heater able to provide hot water for one bath (2,5 GPM/10 Liters Per Minute) and dishwashing (1,5 GPM/5.7 LPM), then you will have to buy a 2,5+1,5 = 4 GPM (15 LPM) water heater.
Note: The performance of tankless water heaters is affected by the temperature of the groundwater, especially in cold climates. If the groundwater temperature in your region is lower than the average (50ºF/10ºC) you may need a slightly larger water heater.