In short
Ask a tricky maths question and get a confident wrong answer. Ask the model to work it out step by step, and it often gets it right. That's chain-of-thought, and it's one line of prompt.
Prompting a model to reason step by step before giving a final answer — dramatically improves performance on multi-step reasoning and math tasks.

Think of it like this
Rough work in the exam margin
In a maths exam, the toppers don't jump to the answer. They do rough work in the margin: write what's given, solve in steps, then circle the answer. Teachers even give marks for steps. Chain-of-thought asks the model to do its rough work too.
Watch it happen
Direct answer vs thinking first
Pens cost Rs 12...
1/6'A pen costs Rs 12. Buy 5, get 1 free. How much for 12 pens?'
The big ideas
What you need to know
Steps before answer
Writing intermediate steps gives the model more tokens to 'think' with before it commits to a final answer.
Best for multi-step tasks
Maths, logic, planning and multi-rule decisions benefit most. Simple lookups don't need it.
Reasoning models do it built in
Some newer models reason internally before answering. For them, asking for visible steps may add little.
Separate thinking from output
Ask for reasoning in one section and the final answer in another, so your app can show only the answer.
See it in code
Walk through the code
1A pen costs Rs 12. The shop has an offer: buy 5, get 1 free.2How much do 12 pens cost?3 4Think through the problem step by step inside <thinking> tags.5Then give only the final amount inside <answer> tags.1/3The question, with a twist that trips up quick answers.
Ask for steps, but keep the final answer in its own tag so your code can pull it out cleanly.
Save yourself the pain
Common mistakes
Oops
Using chain-of-thought for every simple task.
Do this instead
It adds tokens and latency. Use it where accuracy on multi-step problems actually improves.
Oops
Assuming correct-looking steps mean a correct answer.
Do this instead
Models can write convincing but wrong reasoning. Check final answers on a test set.
Your mission
Measure the difference
Quick check
When does chain-of-thought prompting usually help the most?
Go deeper
- 1Compare direct-answer vs. 'think step by step' prompting on a reasoning task.
- 2Learn when chain-of-thought helps a lot (math, logic) vs. barely at all (simple lookups).
- 3Understand how reasoning models build this capability in natively rather than via prompting.
More topics at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.