I have a 30 amp circuit breaker installed for my tank type hot water heater. I would like to replace the hot water heater with a tankless hot water heater that requires a 40 amp circuit breaker. I don’t know the gauge of wiring used for the circuit breaker but is it possible to just replace the 30 amp breaker with a 40 amp breaker?
Your current 30A water heater circuit was probably wired with #10 solid copper. You can confirm this by inspecting the stamp or printing on the cable jacket, or by using a gauge measuring tool (with the power safely disconnected).
A 40A circuit typically calls for #8 copper wire, which is usually stranded. It's a markedly larger cable bundle. If you don't have that, DO NOT increase the breaker size. A circuit breaker's primary function is to protect wiring from overload, and a 40A breaker does not adequately protect #10 wire.
This is standard advice and doesn't apply to inordinately long runs or other nonstandard scenarios which may call for even larger wire.
In general, NO. Doing so is very dangerous and could start a fire!
10 gauge wire requires at most a 30A breaker, whereas 8 gauge requires at most a 40A breaker. It's possible the builder ran #8 wire to the water heater, in a bit of forward-thinking future proofing, but it's more likely they only ran #10, and thus stuck a 30A breaker on. You cannot put a 40A breaker on #10 wire. Doing so risks starting a fire and burning the house down.
If you are sure there is (at least) #8 wire all the way from the breaker to the water heater, you can just replace the 30A breaker with a 40A breaker, but if and only if you have verified the size of the wire throughout the entire circuit.
I don't know the gauge of the wiring
Knowing wire gauge is a prerequisite to any breaker change. Breakers protect wires.
Tankless are awesome. But DO NOT make the mistake of undersizing a tankless. Making heat on-demand requires a great deal of energy, and needs possibly very large service depending on how hungry your house is. If you botch this, you will hate tankless and be forever put off by them, which would be a real shame.
Another thing to mull is, since I'm guessing you'll have to rewire regardless, think about locating the on-demand(s) near the points of use. They are tiny, they fit under a cabinet, unlike a 30 gallon boiler. Greatly shorten the piping from heater to spigot, greatly reduce the wait-wait-wait for hot water. (Helps to downsize the pipe as well, less pipe volume = quicker fill).
I suggest you not to do so, check cable thickness first.
Also a 40A (8.8kW) device provides a very low flow for a whole-house (it can raise by 30°C a flow of about 4.5l/min) [1.2GPM @85°F]. With such small water heater you'll take too much time to fill a tub. But a single shower may be good (but not great). If you can have gas, have piping installed and go with gas. A 35 kW heater can run a 17l/min flow (30°C heat-raise) [4.5GPM @85°F].
Breakers are matched to wiring, in the same way that brakes and tires are matched to the vehicles they are installed on.
That 30A breaker protects you from excess current flowing through the system. Installing a 40A breaker raises the ceiling on the allowed current. Now more current can flow than your wiring can accommodate, which generates heat in that wiring. Run the circuit at 39A and your wires might melt or catch fire, given enough time and bad luck. The breaker won't trip though because it's rated for 40A.
Some here have raised the possibility your wires might have been overspecced from the beginning, allowing a 40A breaker. OK, but who would do that and why? Your electrical system is installed as a complete system designed to work together. Overpaying by installing up-rated wiring isn't real popular!
Think of it like this. You just swap out a 30A breaker with a 40A breaker. You're allowing the electrical system (not just the breaker) to run at 33% over it's rated capacity. What do you think happens to your safety margin when you do that? You don't have a safety margin anymore; you're dancing with Pele.
If the wire is in open air, as opposed to being enclosed in a wall with insulation or bundled with other wires, then its temperature will be within safe limits at 40A with 10 AWG copper. But you're probably violating some rules. Someone could come along later and put insulation around it creating a hazard. Also, you would be wasting more energy by creating extra heat in the wire.
The US electrical code is kind of strange. It allows you to put a 60A breaker (4 times the heat generated in the wire) on a normally 30A 10 AWG circuit if it is a dedicated welder circuit, since welders have limited duty cycles.
Are you sure you need to replace the breaker?
Hear me out... Where I live breakers must carry the must-hold current + 33% for 1 hour. It wouldn't surprise me if the same applies where you are. That would take you from 30A to 40A. How likely are you to run the hot water for an hour?
This is partly how you can run a welder on an ordinary socket outlet (well I can, here in 230V-land), even though the welder's input current significantly exceeds both the socket outlet's nominal rating and the controlling circuit breaker's. The low duty cycle takes care of things.
I have no idea what your local wiring code says about this, though. But you won't be melting any wires if you don't install an oversized (for the wiring) breaker.
Short answer: NO!
The breaker is there to protect the cable from short circuits and overheating, thus preventing fires. The rating of the cable is not only based on its size or gauge but also on the individual installation conditions along each individual part of its run. Cables installed through batts or insulation on a part of the run have a lower current rating for the same gauge than cables installed in free air or, underground or possibly, in conduit, for example. Cables installed through a roof space often have a lower current rating than cables installed under a house too, for example, because of the higher ambient temperature in a roof. The total length of the cable run is also a factor, longer runs can require you to go one or more gauges heavier (due to VD/A/ft) but this does not increase the current carrying capacity at all in that case.
The original breaker would have been sized according to the maximum current that the existing cable could withstand, which would have been chosen according to the maximum current load of the old water heater. Hardly anyone installs cables larger than what is needed because bigger cables are more expensive.
It is highly unlikely that you will not need to install new, larger and, suitable cable if you have now purchased a higher current water heater.
Take the new water heater back and get one with the same rating as the old one.
Even if this does work in a lab setting for a short period of time, by changing the breaker / fuses to a higher value, you allow a higher current in your circuit. This may cause the wires to overheat, and start a fire. If a fire occurs, even from another cause, a "sloppy" investigator may conclude that the fire was caused by improper combination of breaker/wires, which is a very valid explanation.
My recommendation is to have the proper wire gauge (matching or exceeding both voltage and current). If you are diy person, have it inspected by somebody certified before power on. This way, you are absolved of any fault.