Claude Chain of Thought Prompting for Multi-Step Math Problems
To solve multi-step math problems accurately with Claude, add a simple instruction — "Think step by step before giving your final answer" — to any prompt. This activates chain-of-thought (CoT) reasoning, which guides Claude to break the problem into a sequence of intermediate steps rather than jumping straight to a conclusion. The result is a visible, checkable solution path that dramatically reduces the chance of skipped logic or arithmetic errors.
What Is Chain-of-Thought Prompting in Claude?
Chain-of-thought (CoT) prompting is a technique that instructs Claude to break a complex problem into a sequence of intermediate reasoning steps before producing a final answer. Rather than jumping directly to a conclusion, Claude is guided to "show its work," which reduces logical leaps, mathematical errors, and unsupported analytical claims. The core idea is that structured deliberation produces more accurate, nuanced, and verifiable outputs than immediate text generation.
For math specifically, this matters because multi-step problems — compound interest, combinatorics, unit conversions, word problems with embedded conditions — require each sub-step to be correct before the next one can be. Without CoT, Claude may skip steps and produce a wrong answer. With CoT, each sub-step is made explicit and checkable.
You can learn more about the underlying technique in the chain-of-thought prompting documentation.
How Do You Activate Chain-of-Thought for Math Problems?
There are two broad implementation paths, and both work on every Claude plan — Free, Pro, Max, Team, Enterprise, Claude Code, and the API.
Path 1: Natural-Language Instructions (No Setup Required)
The simplest approach is to include a reasoning instruction directly in your prompt. This works in the Claude.ai chat interface and in any API call without changing any parameters.
- Add
Think step by step before giving your final answer.to the end of your math prompt. - Or ask Claude to place its reasoning inside
<thinking>tags and its final answer inside<answer>tags — this separates the work from the conclusion so you can review each independently.
Path 2: API-Native Thinking (For Developers)
The more powerful path uses the API's native thinking parameter, which lets Claude allocate dedicated compute to reasoning and returns structured thinking blocks alongside the final response. On newer models — Sonnet 4.6, Opus 4.6, and later — this is called Adaptive Thinking, where Claude dynamically decides how much to reason based on query complexity and a developer-chosen effort level of low, medium, or high. You can read the full technical details in the Extended Thinking overview.
Step-by-Step: Solving a Math Word Problem with Claude CoT
Here is a concrete walkthrough using the natural-language approach — no API required, works on any plan.
- State the problem clearly. Write out the full math problem in plain language. Include all given values and what you need to find.
- Append the CoT instruction. At the end of your prompt, add: "Think step by step before giving your final answer."
- Send the prompt. Claude will reason through each sub-step before stating its conclusion.
- Verify each step. Read through the intermediate steps. If one is wrong, you can identify exactly where the logic broke down and ask Claude to correct from that point.
Example prompt:
A farmer has 10 sheep. All but 3 run away. How many are left?
Think step by step before giving your final answer.
Example output:
Step 1: The phrase 'all but 3' means 3 sheep did NOT run away.
Step 2: The remaining sheep = 3.
Final answer: 3 sheep are left.
Even simple-sounding problems can be misread without explicit reasoning. The phrase "all but 3" is a common trick question that Claude answers correctly when it reasons step by step.
How Do You Use XML Tags for Structured Math Reasoning?
For more complex problems — or when you want to clearly separate Claude's working from its final answer — ask Claude to use XML-style tags:
Solve the following problem. Show all your reasoning inside <thinking> tags,
then state only the final answer inside <answer> tags.
A store sells a jacket for $80 after applying a 20% discount.
What was the original price? What is the dollar amount saved?
Claude will produce a <thinking> block with each algebraic step and an <answer> block with the clean result. This structure lets you audit the math independently of the conclusion — useful when you need to share the answer with someone who doesn't need to see the working, or when you want to paste only the final result into a report.
When Should You Use API Adaptive Thinking vs. a Simple Prompt Instruction?
The right approach depends on your context. Here is a comparison to help you decide:
| Approach | Best For | Requires | Returns Thinking Blocks? |
|---|---|---|---|
| "Think step by step" in prompt | Quick prototyping, any plan, any model | Nothing — just add the phrase | Inline in the response text |
<thinking> XML tags in prompt |
Separating reasoning from final answer in UI or API | Nothing — just ask for the tags | Yes, as tagged sections in the text |
| API Adaptive Thinking (Sonnet 4.6+, Opus 4.6+) | Production apps, dynamic compute allocation, tool-use loops | API access, supported model | Yes, as structured thinking blocks in the API response |
| Standard prompting (no CoT) | Simple factual queries, low-latency needs | Nothing | No |
A key rule from the source material: when the API thinking parameter is already active, remove explicit CoT instructions from your prompt. The model's native thinking capability is designed to work without them, and redundant instructions can interfere with the reasoning process.
What Are the Most Common Mistakes When Using CoT for Math?
Forgetting to ask for reasoning at all
Without an explicit instruction — either a natural-language phrase or the API thinking parameter — CoT does not activate. Always include a reasoning instruction for any problem where intermediate steps matter.
Using CoT on every query regardless of complexity
CoT increases output length and, with API thinking enabled, token usage. Reserve CoT for high-stakes or complex tasks. For simple factual queries, skip CoT entirely to keep latency and costs low.
Using the wrong API parameter for your model
Newer models — Sonnet 4.6, Opus 4.6, and later — use Adaptive Thinking and reject the older manual token-budget approach, returning an error. If you are on a newer model, use the adaptive thinking configuration with an effort level instead. Check the Extended Thinking documentation for the correct parameters for your model.
Stripping thinking blocks in agentic loops
If you are building a multi-turn agent that uses tool calls — for example, a math tutor that fetches formula references — include the model's previous thinking blocks unchanged when passing tool results back. Removing them breaks reasoning continuity and degrades output quality on subsequent turns.
Is Chain-of-Thought Prompting Worth It for Math Problems?
For any problem with more than one dependent calculation, yes. The core benefit is verifiability: when Claude shows its work, you can check each step rather than trusting a black-box answer. This is especially valuable in educational settings (where the process matters as much as the answer), in financial calculations (where a single skipped step can compound into a large error), and in logic puzzles (where ambiguous phrasing like "all but 3" can trip up a model that doesn't reason carefully).
For simple, single-step arithmetic — "what is 12 times 7?" — CoT adds length without adding value. Use your judgment: the more steps a problem requires, the more CoT earns its keep.
CoT prompting is available on every Claude plan, including Free, so there is no barrier to trying it immediately. Open a conversation on Claude.ai, paste a multi-step math problem, and append "Think step by step before giving your final answer" — that single phrase is all it takes to get structured, auditable reasoning from Claude.
Frequently asked questions
Does chain-of-thought prompting work on the free Claude plan?
Yes. The natural-language approach — adding 'Think step by step before giving your final answer' to your prompt — works on every Claude plan, including Free, with no settings changes required.
What is the simplest way to get Claude to show its math work?
Append 'Think step by step before giving your final answer' to your prompt. Claude will then reason through each intermediate calculation before stating the result.
How do I separate Claude's reasoning from its final math answer?
Ask Claude to place its working inside <thinking> tags and its final answer inside <answer> tags. This works in the Claude.ai UI and via the API without any special parameters.
Should I use 'think step by step' and the API thinking parameter together?
No. When the API thinking parameter is active, remove explicit CoT instructions from your prompt. The model's native thinking capability is designed to work without them, and redundant instructions can interfere with the reasoning process.
What types of math problems benefit most from chain-of-thought prompting?
Problems with several dependent calculations — such as compound interest, combinatorics, unit conversions, and word problems with embedded conditions — benefit most, because each sub-step must be correct before the next one can proceed.
What is Adaptive Thinking and how does it differ from standard CoT prompting?
Adaptive Thinking is an API-native feature on newer Claude models where Claude dynamically decides how much to reason based on query complexity and a developer-chosen effort level (low, medium, or high). Standard CoT prompting uses a natural-language instruction in the prompt and works on any model or plan.
Chain-of-thought is one of 85 features in Claude Master — the independent, continuously updated manual with worked examples, the pitfalls, and the workflows that put Claude to work.
Get Claude Master — founding price →Independent product. Not affiliated with or endorsed by Anthropic. "Claude" is a trademark of Anthropic, used here only to describe the subject of this guide.