The unit for electrical energy is the joule.
In order to calculate electrical energy, you need to know how much power is being used and for how long that power is used for. The electrical unit for power is the watt. The formula calculating electrical energy then is the following formula.
Electrical energy = Power x Time
Electrical energy is expressed in joules, power is expressed in watts, and time is expressed in seconds.
For example, if a 100 watt light bulb is turned on for one hour (3600 seconds), you can use the above formula to calculate how many joules of energy are being used.
Energy = 100 watts x 3600 seconds
Energy = 360,000 joules
As you can see, the numbers will get big very quickly. That's why some power companies will express electrical energy consumption in kilojoules. The above number would then be 360 kilojoules.
Power companies generally go even one step further to calculate electrical energy. A joule or kilojoule is still a relatively small amount, so power companies sell electrical energy by a different unit. That unit is the kilowatt hour. A kilowatt hour is the amount of electrical energy that is used by a 1,000 watt appliance over the course of an hour.