Chain-of-Thought Prompting: Ask for Step-by-Step Reasoning
Prompt the model to reason step by step to improve accuracy on multi-step math, logic, and planning tasks.
Direct answer
Chain-of-thought prompting asks the model to work through its reasoning step by step before giving an answer, which improves accuracy on multi-step math, logic, and planning. Add an instruction like 'think step by step and show your reasoning, then give the final answer'. It helps complex tasks and is unnecessary for simple lookups.
Open the Prompt OptimizerWhen to use this
- The task involves multiple steps: math, logic, or planning.
- The model jumps to a wrong answer without showing its work.
- You want to see the reasoning to catch mistakes.
Steps
- State the problem clearly.
- Add: think step by step and show your reasoning.
- Ask for the final answer on its own line at the end.
- For consistency, request the same reasoning format each time.
- Skip chain-of-thought for simple, single-step tasks.
Example
If a train travels 60 miles in 1.5 hours, what is its average speed? Answer only.
Solve this step by step, then give the final answer on the last line. Problem: A train travels 60 miles in 1.5 hours. What is its average speed? Reasoning: speed = distance / time = 60 / 1.5. Final answer: 40 mph.
Common mistakes
- For trivial tasks, step-by-step reasoning just adds length with no benefit.
- If you only want the answer, still ask for reasoning first, then the final line — do not suppress it entirely on hard tasks.
- Long reasoning uses more tokens; keep it when accuracy matters, drop it when it does not.
FAQ
- What is chain-of-thought prompting?
- It is asking the model to show its step-by-step reasoning before answering. On multi-step problems this improves accuracy compared with demanding an immediate answer.
- When does it help?
- On math, logic, and planning tasks with several steps. For simple factual lookups it adds length without improving the result.
- How do I still get a clean final answer?
- Ask the model to reason first and then put the final answer on its own line, so you get both the working and an easy-to-extract result.
Related Prompt Optimizer guides
How to Structure a Prompt (Template)
The building blocks of a strong prompt — role, context, task, constraints, output format, and examples — with a reusable template.
Write a Prompt From a Rough Idea
Turn a one-line idea of what you want into a full, ready-to-paste structured prompt.
Few-Shot Prompting: Add Examples to Your Prompt
Show the model one to three input-output examples so it copies the pattern you want.
Role and Persona Prompting (Act As)
Assign the model a role or persona to control tone, depth, and vocabulary in its answers.
Control the AI Output Format (JSON, Tables, Lists)
Get consistent, parseable output by specifying the exact format, fields, and what to exclude.