Back to cookbook

Chain-of-Thought Prompt for Step-by-Step Reasoning

Updated
Share

This is a chain-of-thought prompt that gets ChatGPT, Claude, or Gemini to reason through a problem step by step before giving a final answer, instead of jumping straight to a conclusion. It's built for anyone working through a math problem, a logic puzzle, a multi-step business decision, or any task where the model's reasoning matters as much as its answer.

Without an explicit instruction to think it through, models often skip straight to an answer and skip steps that would have caught an error. This template forces a visible reasoning trace followed by a clearly separated final answer, so you can check the logic before you trust the result.

Prompt template

You are a careful problem-solver who reasons step by step before answering.

Problem: [DESCRIBE THE PROBLEM OR QUESTION]

Relevant facts or constraints: [LIST ANY NUMBERS, RULES, OR CONSTRAINTS]

Instructions:
1. Work through the problem step by step, showing each step of your reasoning.
2. Double-check any calculation before moving to the next step.
3. If a fact is missing, state what you're assuming instead of guessing silently.
4. After your reasoning, write "Final answer:" on its own line followed by a single, direct answer.

Output format:
Reasoning:
[step-by-step reasoning]

Final answer:
[one direct answer]

Example input

Problem: A team of 5 people can complete a project in 12 days. If 3 more people join with the same productivity, how many days will the project take?
Relevant facts or constraints: Assume all workers have equal, constant productivity.

Example output

Reasoning:
1. Total work = 5 people x 12 days = 60 person-days.
2. New team size = 5 + 3 = 8 people.
3. Days needed = 60 person-days / 8 people = 7.5 days.

Final answer:
7.5 days

When to use it

  • Math word problems, logic puzzles, or multi-step calculations
  • Decisions with several weighted factors, like choosing between vendors
  • Debugging why an earlier answer from the model was wrong
  • Any task where you need to audit the reasoning, not just the answer

Best practices

  • Ask for the reasoning and the final answer in two clearly labeled sections
  • Give the model permission to say it's unsure instead of guessing
  • Keep the problem statement precise; vague inputs produce vague reasoning
  • Re-run with "check your work" as a follow-up when the stakes are high

Common mistakes

  • Asking for "the answer" without reasoning, then trusting the first number given
  • Burying the actual question inside a long paragraph of context
  • Not specifying units or constraints, letting the model assume them
  • Accepting a plausible-looking reasoning trace without checking it yourself

FAQs

Does chain-of-thought prompting actually improve accuracy?

For multi-step math, logic, and planning tasks, asking a model to reason before answering generally produces more reliable results than asking for a direct answer, because it gives the model room to catch its own errors mid-reasoning.

Should I always ask for step-by-step reasoning?

No. For simple factual lookups or short creative tasks it just adds noise. Save it for problems with multiple steps or where you need to verify the logic.

Can I hide the reasoning from the end user but still use this prompt?

Yes. Ask the model to keep the reasoning section in its response for you to review, then only forward the final answer line to whoever needs the result.

Does this work the same way in ChatGPT, Claude, and Gemini?

The structure works across all three. Some models are more verbose by default; if the reasoning gets too long, add a constraint like "keep each step to one sentence."

Found this prompt useful? Share it.

Share