One kilowatt-hour is exactly 3.6 megajoules. It is the tidiest conversion in the energy category — a single decimal figure with no rounding — because both units are built from the same seconds and watts.
About the units
The megajoule is a million joules, an SI quantity. The kilowatt-hour is a thousand watts sustained for 3,600 seconds. Since a watt is a joule per second, the product is 3,600,000 joules, or 3.6 MJ. The two units divide the world between them by discipline rather than by size: energy utilities, appliances and batteries use kilowatt-hours, while physics, engineering and national statistics use joules and their multiples. Neither is more correct, but only one of them is SI, and standards documents therefore favour the megajoule even when the meter on the wall reads in kilowatt-hours.
The exact factor
The factor is exactly 3.6. Some useful equivalents at this scale: a litre of petrol contains about 34 MJ or 9.4 kWh of chemical energy; a kilogram of natural gas about 54 MJ or 15 kWh; and a kilogram of lithium-ion battery stores roughly 0.9 MJ or 0.25 kWh, which is the ratio that explains why electric aircraft are hard. A gigajoule, the unit district heating is often billed in, is 277.8 kWh.
Where you meet this conversion
Energy policy and statistics, where national consumption is published in petajoules by some agencies and terawatt-hours by others, and comparing two reports requires the conversion. Fuel energy content is tabulated in megajoules per kilogram or per litre while vehicle efficiency is quoted in kilowatt-hours per hundred kilometres. Food energy, building energy performance certificates and industrial process heat all appear in one unit or the other depending on the jurisdiction and the year.