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.
Desk gear for long writing sessions
A few things that help if you write docs, tickets, and specs on a laptop all day.
Anker 5-in-1 USB-C Hub
One cable turns a laptop into a desk setup. Drives a 4K display, charges at up to 85W, and adds three data ports.
- 4K HDMI output
- 85W max power delivery
- 1x USB-C + 2x USB-A, 5Gbps each
- MacBook Pro, MacBook Air, Dell
Dell 27" S2725QC 4K
The monitor I write and review documents on. 163 PPI keeps small text sharp, and USB-C carries video and power on one cable.
- 3840x2160 IPS, 163 PPI
- 120Hz, 4ms, FreeSync Premium
- 99% sRGB
- USB-C, HDMI, DisplayPort
Apple MacBook Neo 13" (A18 Pro)
The cheapest way into an Apple-silicon machine that runs local models. Fanless, and the Liquid Retina panel holds small text at a full day of reading.
- A18 Pro chip, built for Apple Intelligence
- 8GB unified memory, 256GB SSD
- 13-inch Liquid Retina display
- 1080p FaceTime HD camera
Amazon affiliate links. We earn a commission on qualifying purchases at no extra cost to you.