Chain of Thought Prompting: How to Get Better Answers
Chain of thought prompting asks a language model to show its working before it answers. Here is how it works, when it helps, and how to write prompts that use it.
On this page
Short answer
Chain of thought prompting is a way of asking a large language model to work through a problem step by step, in words, before giving its final answer. Instead of jumping straight to a result, the model writes out each intermediate step, which makes multi-step problems such as arithmetic, planning and sorting easier to get right. The written steps also make it possible to see where an answer went wrong.
What is chain of thought prompting?
Chain of thought prompting is a prompting technique in which a language model is asked to reason out loud, writing each step of its thinking before it gives a final answer. The model still produces text, but the text includes the working, not just the result.
The idea is simple: many problems are easy to get wrong in one jump and easy to get right in small steps. A model asked for the total of a long bill may guess; the same model asked to add the lines one at a time usually gets it right. The steps act as a scratch pad that keeps the model on track.
| Prompt style | What the model does | Best for |
|---|---|---|
| Zero-shot | Answers with no examples | Simple, familiar questions |
| Few-shot | Copies the pattern of given examples | Tasks with a fixed format |
| Chain of thought | Writes out steps before answering | Multi-step reasoning |
| Self-consistency | Tries several chains and picks the common answer | Problems where one chain may slip |
Chain of thought is not a separate model or a special mode. It is a way of writing the prompt, and it works with the general models teams already use. For the wider context, see what prompt engineering is and why it matters.
How does chain of thought prompting work?
Chain of thought prompting works by turning one hard question into a short series of easy ones, each answered in the open. The model reads the prompt, writes the first step, then uses that step as part of the context for the next one, so each step builds on the last.
The most common form is to add a short instruction such as "think step by step" to the prompt. A stronger form gives one or two worked examples in which the reasoning is written out before the answer, so the model copies that shape. Both forms do the same job: they make the model spend more of its output on the working and less on guessing the end result.
The effect is strongest where the answer depends on intermediate values. In arithmetic, the model needs the running total. In planning, it needs the list of constraints before it picks a date. In sorting or ranking, it needs the criteria applied to each item before it orders them. Writing the steps down keeps those values visible instead of letting them blur together.
There is a cost: longer answers use more tokens and take longer to produce. That is why the technique is used for hard questions rather than every question. A team that routes only the tricky cases to chain of thought prompts gets most of the benefit without paying for it on every request.
When does chain of thought prompting help most?
Chain of thought prompting helps most with problems that have several steps and one right answer, where a single mistake early on ruins the result. Arithmetic, logic puzzles, scheduling, data checks and multi-hop questions are the classic cases.
It helps less with open-ended writing, where there is no right answer to work towards. A model asked to draft a welcome email does not need to show its working, and the extra steps add nothing. It also helps less with simple lookups, such as asking for a definition or a date, where the answer is a single fact.
The clearest signal is whether the task can be split into steps that are each easy to check. If a person can say "first do this, then do that" about the task, chain of thought prompting will usually improve the result. If the task cannot be split that way, another technique is likely a better fit.
How do you write a chain of thought prompt?
You write a chain of thought prompt by stating the task, asking for the steps, and giving the model a shape to follow. The prompt should make the working visible, not just request it in passing.
- State the task and the output shape. Say what the final answer should look like, such as a number, a date, or a short list, so the steps lead somewhere specific.
- Ask for the steps explicitly. Add a line such as "Work through this step by step, showing each calculation" rather than relying on the model to do it on its own.
- Give one worked example. Show a small version of the problem with the reasoning written out, so the model copies that format instead of inventing its own.
- Keep the steps small. If a step still hides two or three operations, split it. Each step should do one thing that can be checked on its own.
- Ask for a check at the end. End the prompt by asking the model to confirm the final answer against the steps, which catches slips made near the end.
Test the prompt on a set of real examples before using it in production, including the awkward cases. A prompt that works on a clean example may still fail when the input is messy or incomplete. The guide to implementing prompt engineering in a team covers how to run that testing in practice.
What are the limits of chain of thought prompting?
Chain of thought prompting has clear limits. The steps a model writes are not proof that it reasoned correctly; a model can write a neat chain of steps and still reach a wrong answer, and it can also write steps that sound right while hiding a mistake in the middle.
Long chains can also drift. Each step adds a chance to go off track, and once the model has written a wrong intermediate value, later steps tend to build on it rather than correct it. That is why asking for a final check helps, but it does not remove the risk.
The technique does not add knowledge the model lacks. If the model does not know a fact, showing its working will not invent it, and it may instead state a wrong fact with confidence. For questions that need fresh or specific facts, retrieval from a trusted source matters more than the prompting style.
Finally, the extra output costs time and money. Chains of thought can be several times longer than a direct answer, so teams that use them on every request pay for it. The sensible pattern is to use them where accuracy matters most and keep simple questions direct.
Example (hypothetical): a support team checks a refund total
Example (hypothetical): a support team asks a model to check a refund made of three items: $48.50, $12.99 and $7.25. Asked for the total directly, the model answers $68.47, which is wrong by 27 cents and would be paid out if nobody checked.
Asked to work step by step, the model writes: $48.50 plus $12.99 is $61.49, and $61.49 plus $7.25 is $68.74. The arithmetic is easy to check: 48.50 plus 12.99 is 61.49, and 61.49 plus 7.25 is 68.74. The team can see the two additions and confirm them in seconds.
The lesson is not that the model became cleverer; it is that the steps made the working visible. The same team now asks for step-by-step working on every refund check over $50, and a person reviews the steps before the money moves. The cost is a few extra seconds per check, and the benefit is that errors surface where they can be fixed.
Common mistakes
Most chain of thought mistakes come from trusting the steps too much or writing prompts that hide the working. Teams ask for steps, see a tidy answer, and stop checking, which defeats the purpose.
- Asking for steps but accepting the first answer without reading them
- Using long chains for simple questions, which wastes time and tokens
- Writing prompts with no worked example, so the model invents its own format
- Letting one step hide several operations, so errors pass unnoticed
- Treating a confident chain of steps as proof the answer is right
- Using chain of thought where the real problem is missing facts, not reasoning
- Skipping the final check that compares the answer with the steps
The fix is to treat the steps as a draft to review, not as a guarantee. Read them, check the arithmetic, and confirm any fact the answer depends on. That habit is what turns the technique from a neat trick into a reliable part of a workflow.
Key takeaways
- Chain of thought prompting asks the model to show its working before answering.
- It helps most with multi-step problems where one early mistake ruins the result.
- A worked example in the prompt makes the model copy a clear format.
- The steps make errors visible, but they do not prove the answer is right.
- Use it where accuracy matters and keep simple questions direct.
Frequently asked questions
Does chain of thought prompting work with any language model?
It works with most general large language models, since it is a way of writing the prompt rather than a special feature. Smaller or older models may follow the format less reliably, so test it on the model you actually use before relying on it.
How is chain of thought different from few-shot prompting?
Few-shot prompting gives examples of inputs and answers, while chain of thought prompting gives examples that include the reasoning steps before the answer. The two can be combined: show a few examples with their working, and the model will copy both the format and the reasoning style.
Should I use chain of thought for every prompt?
No. It adds output length, time and cost, so it is best kept for questions where accuracy matters and the answer depends on several steps. Simple lookups, definitions and open-ended drafting usually do not need it.
Can chain of thought prompting fix a model that lacks facts?
No. Showing the working does not add knowledge the model does not have, and it can make a wrong fact look more convincing. When the answer needs fresh or specific facts, pair the prompt with retrieval from a trusted source.
What is self-consistency in chain of thought prompting?
Self-consistency means running the same question several times with different chains of reasoning, then taking the answer that appears most often. It costs more than a single run but catches cases where one chain goes wrong.
How do I test a chain of thought prompt?
Build a small set of real examples with known answers, run the prompt on them, and read the steps for the ones it gets wrong. Fix the prompt where the steps went off track, then re-run the set to confirm the change helped.