Can You Choose Gas?
If you don't have natural gas in your house, a natural gas heater is obviously not an option---but a propane one is, particularly if you are using it already for heating and/or cooking. What's more, the savings on either fuel compared with electricity are so great that unless your heater is going to receive only light and occasional use, it will be worth your while to pay to have existing natural gas or propane lines extended to reach the heater.
Speed of Heating
Gas is a much faster means of heating water than electricity. This means that, size for size, a gas heater is capable of producing more hot water more quickly than an electric heater.
Purchase and Running Costs
Electric water heaters are slightly cheaper than gas ones, but natural gas is typically about half as expensive as electricity as a fuel for heating water, and propane is also much cheaper. Your maintenance costs are potentially somewhat higher for gas, since you will need to have a professional to do it, whereas it is possible to carry out routine maintenance on an electric water heater yourself.
Overall, though, the difference in the actual cost of heating water is so great that gas wins every time.
Because gas heaters involve combustion, whereas electric water heaters don't, they are potentially more dangerous. The process of burning gas uses up oxygen and produces toxic byproducts.
Under normal circumstances, the levels of these that are produced are minimal and harmless. If you neglect maintenance, however, that can change---and there is even the small risk of explosion.
Maintain your gas heater properly to avoid these risks, and make sure that you have functioning smoke and carbon monoxide alarms installed.
Capacity Isn't Everything
Whatever type of heater you buy, bear in mind that there is more to your choice than mere capacity. Every heater has what is known as an FHR, a "first hour rating," that tells you how much hot water it can produce in an hour of use.
For most people, this is a far more useful gauge of whether a heater will give you the hot water that your usage patterns demand.
Warranties Tell You Something
Paying for a heater with a longer warranty is usually a good investment. The longer a heater's warranty, the better its insulation and the bigger its burner or heating element is likely to be.
The Bottom Line
Gas is best if you can have it. Gas heaters are so much more efficient that if you have gas available, you should always choose one.
They are safe if properly maintained, and will heat your water more quickly and cheaply.