It takes more energy to create than you get out from any fuel as scrap heat is always part of the reactions and nothing is 100% efficient.
It is just a case of what type of energy and when it was used
Remember what you were taught in physics !
Energy can not be created nor destroyed it just gets converted from one form to another
Oil comes from decaying vegetable matter that started with solar energy going into the plants to grow + some chemical energy then more energy for the bacteria to break it down then more again to compress it to form a liquid by pinching some hydrogens from the surrounding rock.
When I was at uni 60's & 70's the entire physics building was lit by solar power, directly in the day light & from a hydrogen powered turbine using hydrogen & oxygen electrolised from water connected to another bank of solar cells overnight .
That same building is now 100% solar powered using both the generator & some batteries of differing chemistries.
The problem with Hydrogen is purely the size of the H2 molecule, it is so bloody small it is near impossible to keep it contained .
Then when you add the very high energy & high volatility of hydrogen leaking becomes a big fire / explosion risk.
Thus currently it's use in transport is limited to things where the heavy weight of the containers needed to store it are a benefit like busses, trains & earthmoving equipment .
Hydrogen passes through steel like a hot wire passes through butter.
The conversion of electrical energy into mechanical energy is far superiour than converting chemical energy to mechanical energy so from an energy effiency point of view electricity is way out front .
What puts the brakes on it is the energy density of the batteries used to convert chemical energy into electrical energy
Thus eventually batteries will be the future, there is no two ways around it and the planet will be the better for it , if & when we can find a benign battery and that is the problem
Right now the flow cell battery is head & shoulders above any other technology for battery back up as it is a forever battery than has removable ( thus replaceable ) electrodes and an electrolyte than can be pumped out , reconditioned then replaced .
Really big ( grid sized ones can have electrolyte reconditioning systems built in ). They have 2 downsides , first they are nearly 2 times the size of a Li battery per Ah of capacity and secondly the electrolytes used for any chemistry are highly toxic .
We have become so used to disposable battery that we fail to appreciate them for what they really are
A high density of chemical energy packed inside a container, which is the description of a bomb .
And that is the problem.
The more energy a battery can store, the more energy that can be released as an explosion .
And until we find the "magic" battery chemistry & it becomes a world wide standard we are on a hiding to nothing
Just think about the past 20 years
Just how many different types of batteries have we seen and because all of them have different cell voltages none of them are compatiable with the products made for a different battery chemistry
Then when the 3.1V Li battery became the standard we went from 3V to 6V to 12V ( because they were already made to run off car batteries ) to 18V to 24V and now the 48V tools are slowly hitting the market.
None of them are backwards compatible so all of the older stuff becomes landfill which is good for Stanley / B & D but not for any one else or the planet
Oh and Li cells come in a variety of voltages from 3.1V to 3.7V which is one reason why you get battery fires when charged with the wrong charger .