On complex problems — arithmetic, logic, or multi-step analysis — accuracy improves when you let Claude work through the intermediate steps instead of jumping straight to an answer. Asking Claude to "think step by step" like this is commonly called chain of thought.
The simplest approach
Just adding "work through it carefully, step by step" or "write out your reasoning first, then give the answer" at the end of your prompt already helps. Laying out the reasoning before the answer lets Claude catch things it might otherwise have skipped.
Spell out the steps yourself
If you have a specific order of reasoning in mind, telling Claude those steps directly is more reliable. For example, set the sequence to follow:
Solve it in this order. 1) Restate the conditions given in the problem 2) Do the needed calculations or comparisons step by step 3) On the last line, restate only the final answer
Separate the reasoning from the answer
Sometimes you want to see the reasoning but pull out only the final result. Splitting it into sections with XML tags keeps this clean.
Put your reasoning inside <thinking>, and put only the final answer inside <answer>.
This separates the process from the result, so you can grab just the answer when you need it. If you want that answer in a particular output format, specify the format inside the answer section.
When to use it, and when to skip it
Step-by-step thinking pays off most on problems that need reasoning (math, logic puzzles, multi-step analysis, comparing long materials). For simple factual questions or short transformations it is unnecessary and mostly just makes the answer longer.
One thing to remember: making Claude write out a process does not guarantee the reasoning is correct. For important calculations or decisions, check the steps yourself. Recent models (such as Claude Opus 4.8) can also reason more deeply on their own when needed, but prompting for the process is still useful on any model when you want to see the reasoning and control the format.
For more, see the official Anthropic documentation.