Every heat engine wastes some heat. How little? In 1824 Sadi Carnot found the answer: the limit depends only on the temperatures of the hot and cold reservoirs.
💡 Why it works
Carnot imagined an engine with no friction, which takes in heat only at $T_H$, gives it off only at $T_C$, and could run backward as easily as forward. For it, $\dfrac{Q_C}{Q_H} = \dfrac{T_C}{T_H}$ with kelvin temperatures, so $e = 1 - T_C/T_H$. No real engine can do better. If one could, you could use it to drive Carnot's engine backward as a refrigerator, and the pair would carry heat from cold to hot with no outside work, which never happens.
🔑 Key idea
$$e_{\max} = 1 - \frac{T_C}{T_H} \quad \text{(kelvins!)}$$ A hotter source or a colder sink raises the limit. Real engines fall below it.
A real cycle's efficiency always sits below the Carnot limit for its hottest and coldest temperatures. Explore it in the Engines, Refrigerators and Heat Pumps chapter of the Science Lab.
Worked examples
✏️ Worked example: Kelvin reservoirs
What is the best possible efficiency between $500\,\text{K}$ and $300\,\text{K}$?
With Celsius you would get $1 - 25/550 = 95.5\%$, which is wrong.
Answer: $63.8\%$
✏️ Worked example: Check a claim
An inventor claims $50\%$ efficiency for an engine working between $400\,\text{K}$ and $300\,\text{K}$. Possible?
$e_{\max} = 1 - \dfrac{300}{400} = 25\%$.
$50\% > 25\%$, so the claim breaks the second law. No design can do it.
Answer: Impossible
The formula shows the two ways to build a better engine: make the hot side hotter or the cold side colder. That is why power plants run their steam as hot as their materials allow. The cold side is usually the air or a river, so it cannot go much below about $280\,\text{K}$, and absolute zero itself can never be reached, so no engine can ever reach $100\%$.
⚠️ Common mistake
Putting Celsius temperatures into the Carnot formula. The ratio $T_C/T_H$ only means something on a scale that starts at absolute zero; with Celsius, a cold side at $0\,^\circ\text{C}$ would seem to allow $100\%$. Check: add 273 to every temperature before dividing.