11 min read

What Is Chain of Thought Prompting?

Article Summary

This article explains chain of thought prompting, a technique that asks AI models to reason step by step before answering. It covers when the method improves tasks like math, logic, and planning, outlines common variants and best practices, and notes its tradeoffs and reduced impact on newer reasoning models.

Key takeaways

  • Chain of thought prompting asks an AI model to reason step by step before it gives a final answer.
  • It works through the prompt alone, with a cue like “Let’s think step by step” or a few worked examples.
  • It helps most with math, logic, planning, and other multi-step tasks, and adds little to simple lookups.
  • Newer reasoning models already think internally, so explicit cues add less there, but visible steps stay useful for checking work.

Chain of Thought Prompting (CoT) is a prompting technique that asks large language models (LLMs) to reason step by step before giving a final answer. In simple terms, you ask the model to show its work.

Instead of asking for a one-shot answer, you add a cue like “Let’s think step by step” or include a worked example. The model then writes out intermediate steps before it answers, which gives you a reasoning path you can check.

Errors often creep in when a model jumps straight to an answer. By expanding the reasoning surface, CoT helps LLM models slow down, dissect the task, and make fewer mistakes.

However, CoT isn’t a silver bullet. For simple lookups, for example, it may just provide a longer output with no added value. And, in some cases, the model can produce confident but flawed step-by-step logic if the problem is ambiguous or the prompt is poorly detailed.

Understanding the common pitfalls and best practices of CoT prompting is important so you can incorporate it into workflows. Read on to learn more.

Why chain of thought prompting matters

Most LLM mistakes come from compressed or skipped reasoning. Often, a model simply “pattern matches” to a plausible answer and moves on. CoT prompting counteracts this by activating reasoning pathways that resemble human deduction: breaking the problem down, evaluating each part, and then synthesizing a conclusion.

Tasks where chain of thought prompting has the biggest impact:

  • Math and logic tasks: Word problems, probability puzzles, and multi-step calculations benefit from explicit intermediate steps.
  • Planning and procedures: Itineraries, multi-phase project plans, deployment runbooks, and troubleshooting checklists all improve when the model lays out ordered steps.
  • Ambiguous or constraint-heavy work: When inputs are fuzzy or constraints interact (budget, time, resources), CoT helps the model surface assumptions and tradeoffs.

Newer models change the picture. A 2025 Wharton study found that reasoning models o3-mini and o4-mini gained only about 3% from a “think step by step” cue, while responses took 20% to 80% longer.1

How chain of thought prompting works

Chain of thought prompting works entirely through the prompt. You change what you ask for, and the model’s own step-by-step reasoning does the rest.

Here’s what happens behind the scenes:

  1. Prompt with a cue or examples: Add a cue like “Let’s think step by step,” or include one or two worked examples.
  2. Model writes intermediate steps: The model breaks the problem into smaller parts and works through them in order.
  3. Each step conditions the next: The model generates text in sequence, so every written step becomes context for the step that follows.
  4. Final answer you can check: With the steps in view, you can spot a wrong input or faulty calculation before you rely on the result.

That last step is where much of the value sits. Even when the answer is right, seeing the path tells you whether to trust it.

Types of chain of thought prompting

CoT comes in several variants, each suited to different situations. Understanding these options helps you pick the right approach for your task.

Zero-shot chain of thought

  • Zero-shot CoT is the simplest form. You add a phrase like “let’s think step by step” to your prompt without providing any examples. The model generates its own reasoning chain from scratch.
  • It works well when you need quick reasoning without the overhead of crafting examples. It’s what most people mean when they talk about “chain of thought prompting” in casual conversation.

When to use it: Quick reasoning tasks, exploratory work, or when you don’t have good examples handy.

Few-shot chain of thought

  • Few-shot CoT provides one or more example reasoning chains before your actual question. You show the model how you want it to think by demonstrating the pattern first.
  • This approach gives you more control over the reasoning style and format. It’s especially useful when you need consistent output structure or when the task requires domain-specific reasoning patterns.

When to use it: Tasks requiring specific reasoning formats, domain-specific problems, or when zero-shot results are inconsistent.

Auto-CoT and self-consistency

Two advanced techniques build on basic CoT:

  • Auto-CoT automatically generates example reasoning chains rather than requiring you to write them manually. This saves time when you need few-shot examples but don’t want to craft them yourself.
  • Self-consistency samples multiple reasoning paths for the same problem and selects the most common answer. Instead of relying on a single chain of thought, you generate several and let the majority vote determine the final answer. This reduces errors from any single flawed reasoning chain.

When to use them: High-stakes tasks where accuracy matters more than speed, or when you’re seeing inconsistent results from single-path reasoning.

Learn what are the Best Prompt Engineering Techniques for Professionals.

Chain of thought prompting examples

Zero-shot CoT example

Prompt: If a train travels 60 miles in 1.5 hours, what is its average speed? Let’s think step by step.

Output:

  • First, the total distance is 60 miles.
  • The time is 1.5 hours.
  • Average speed = distance ÷ time = 60 ÷ 1.5 = 40 miles per hour.

What’s happening here? Instead of blurting out “40 mph,” the model shows the calculation path. That lets you check both the inputs (distance, time) and the operation (division). If the numbers were wrong, you’d catch it immediately.

Few-shot CoT example

Prompt: Here’s how to solve word problems step by step:

Example 1: Q: A store sells apples for $2 each. If Maria buys 7 apples, how much does she spend? A: Let’s think step by step. First, identify the price per apple: $2. Second, identify the quantity: 7 apples. Third, multiply the price by quantity: $2 × 7 = $14. Maria spends $14.

Example 2: Q: A recipe needs 3 cups of flour for 12 cookies. How much flour for 20 cookies? A: Let’s think step by step. First, find flour per cookie: 3 cups ÷ 12 cookies = 0.25 cups per cookie. Second, multiply by target quantity: 0.25 × 20 = 5 cups. You need 5 cups of flour.

Now solve: Q: A car uses 4 gallons of gas to travel 120 miles. How many gallons does it need for 300 miles?

Output:

Let’s think step by step. First, find miles per gallon: 120 miles ÷ 4 gallons = 30 miles per gallon. Second, find gallons needed: 300 miles ÷ 30 mpg = 10 gallons. The car needs 10 gallons.

These few-shot examples establish a consistent reasoning pattern that the model follows for the new question.

Logic and coding example

Prompt: Write a function to check if a number is prime. Let’s think step by step.

Output:

  • Step 1: Check if the number is less than 2. If so, return false.
  • Step 2: Loop from 2 to the square root of the number (inclusive).
  • Step 3: If the number is divisible by any value in that range, it’s not prime.
  • Step 4: If no divisors are found, return true.

This is a standard, efficient approach for primality testing. The CoT format ensures the model explains the algorithm before coding it, which is great for learning, code reviews, and debugging.

How to use chain of thought prompting

Not every task needs a narrated solution. Use CoT where it genuinely helps.

Use CoT when:

  • The task involves logic, math, planning, or multiple constraints.
  • You need to audit or teach (education, coaching, code walkthroughs, data analysis).
  • The interpretation of the question shapes the answer (assumptions matter).
  • You expect to hand the output to stakeholders who also want the “why,” not just the “what.”

Skip or minimize CoT when:

  • The task is a simple lookup (“What’s the capital of…?”).
  • You’re working with tight latency or token budgets.
  • You need a concise answer and explanation won’t add value.

Helpful patterns to try:

  • “Let’s think step by step.”
  • “Explain your reasoning briefly, then give the final answer in one line labeled ‘Answer:’.”
  • “Show your work as numbered steps, followed by the final result.”
  • “Break the task into sub-problems, solve each, then summarize your conclusion.”

Chain of thought prompting vs other prompting methods

Use the following table to determine which prompting method best suits your task.

Question

If yes

If no

Is your task simple and factual?

Use zero-shot prompting to get a direct response without providing examples.

Move to the next question.

Is there a specific pattern or format you want the model to follow?

Use few-shot prompting to demonstrate the desired output through examples.

Move to the next question.

Does the task require reasoning, such as math, logic, planning, or evaluating trade-offs?

Use chain of thought prompting to encourage step-by-step reasoning.

Consider a concise zero-shot or few-shot prompt.

In practice, these approaches stack well. Many teams combine few-shot examples and a CoT cue to get the best of both worlds: consistent structure plus explicit reasoning. The difference: few-shot prompting shows what a good answer looks like, while CoT asks the model to show how it got there.

Chain of thought prompting with reasoning models

Newer reasoning models, such as the OpenAI o-series, work through problems internally before they respond. So your own “think step by step” cue gives them a much smaller lift. It also makes their responses slower.

Explicit CoT still earns its place in three situations:

  • Non-reasoning models: Standard chat models that answer directly can still benefit from a step-by-step cue on multi-step tasks.
  • Auditable output: When reviewers need to see how you reached an answer, ask for the steps in the response.
  • Teaching and learning: Written-out reasoning shows learners, tutors, and teams how to think through a problem.

Before you add a CoT cue, check which kind of model you’re using. With a reasoning model, ask for the steps only when you need to see them.

Limitations and risks for CoT prompting

CoT is powerful, but it’s not magic. So, keep these tradeoffs in mind:

  • Longer outputs and higher cost: More tokens means more latency and spend. If you don’t need the reasoning, don’t ask for it.
  • Confident but flawed logic: CoT can “explain” an incorrect path persuasively. Guard against this with spot checks, unit tests, or external validators.
  • Overexposure of internal logic: In sensitive contexts (e.g., compliance, exams), revealing the full reasoning chain may be undesirable. Consider concise rationales or justifications instead of verbose chains.
  • Ambiguity amplification: If the prompt is vague, the model may invent steps that feel reasonable but misinterpret the task. Your best defense is a more crisp prompt (scope, variables, constraints).
  • Privacy concerns: If the step-by-step reasoning touches personal or proprietary data, ensure your prompts and outputs comply with data policies.

Risk-smart best practices:

  • Set a format and a finish line: “Explain in 3–6 steps, then output the final answer labeled ‘Answer:’.”
  • Constrain the domain: Provide key facts, rules, and constraints up front to reduce guesswork.
  • Add checks: Ask the model to verify its calculation (“Recompute the final number from the steps to confirm”).
  • Use compact rationales when full chains aren’t needed: “Explain briefly why, then answer.”
  • Automate validation for repeatable tasks: For example, test math outputs with a small script or separate evaluator.

Chain of thought prompting: best practices (you can copy)

Use these patterns to get reliable, readable reasoning.

1. Reasoning + Final Answer Formatting:

      “Solve the problem by explaining your reasoning in 3–6 short steps. Then provide the final result on a new line prefixed with ‘Answer: ’.”

      Why it works: It creates an explanation zone and a result zone, which is easier to read, copy, and evaluate.

      2. Decompose, Solve, Synthesize:

        “Break the task into sub-problems, solve each sub-problem, then combine the results to produce a final answer. State any assumptions.”

        Why it works: Many tasks fail because the model doesn’t split the work. This prompt forces decomposition.

        3. Sanity Checks:

          “After computing the result, verify it with a different method or a quick estimate. If the two don’t match, revisit your steps briefly.”

          Why it works: Encourages the model to catch its own mistakes, especially in math and estimation.

          4. Constraint-Aware CoT:

            “Explain your reasoning, but assume the budget is fixed at $25k, the team has 3 engineers, and launch is in 6 weeks. Account for those constraints in your steps.”

            Why it works: CoT gets stronger when you bake real-world limits into the chain. Otherwise, you’ll get plans that look good on paper, but fail in practice.

            5. Compact CoT (when tokens are tight)

              “Give a concise, 2–3 step rationale, then the final answer.”

              Why it works: You keep the benefits of “show your work,” while controlling latency and cost. If you want to explore these prompting patterns through hands-on exercises and learn how to evaluate their effectiveness, enroll in our ChatGPT Prompt and Context Engineering course.

              Beyond basics: where CoT shines in real work

              Now that you know how to use CoT prompting, let’s connect its use to day-to-day scenarios:

              • Data analysis walkthroughs: Ask the model to interpret a chart or dataset “step by step,” stating hypotheses, checks, and a conclusion.
              • Code reviews and bug hunts: Prompt the model to reason through a suspected bug path, list potential failure points, and propose minimal, testable fixes.
              • Project planning: Have the model outline a plan in phases (requirements, risks, dependencies, milestones) before proposing a timeline.
              • Business decisions: For pricing, product tradeoffs, or vendor comparisons, ask for decision criteria first, then a ranked recommendation.
              • Education and coaching: Teachers, tutors, and learners can use CoT to reinforce how to think, not just what to answer.

              Quick troubleshooting: if CoT isn’t working

              • If outputs are long but unhelpful, tighten the instructions (“3–6 steps only,” “use numbers, not prose”).
              • If steps look plausible, but they’re wrong, supply the correct formula, definitions, or constraints in the prompt.
              • If reasoning drifts off topic, reassert the goal at the end of your prompt (“Your final answer must be a single number with units”).
              • If latency is too high, use compact CoT, reduce context, or reserve CoT for only tough queries.
              • If outputs are inconsistent, add a light few-shot section with one or two good CoT examples before your new question to set the pattern.

              The bottom line on chain of thought prompting

              Chain of Thought Prompting is a simple idea with outsized impact. Ask the model to show its work, and you get better accuracy, more explicit reasoning, and more trustworthy results. The gains are biggest for math, logic, planning, and any problem where assumptions matter, especially with non-reasoning models.

              Start small. Take one workflow where mistakes are expensive or explanations matter most. Add a CoT cue, set a short reasoning format, and capture the final answer cleanly.

              Tweak, measure, and repeat. Before long, you’ll have a lightweight prompting playbook your team can trust, and a set of examples you can reuse across tasks, tools, and models.

              If you want a hands-on approach to chain of thought prompting and the broader toolkit that makes LLMs truly useful, Udemy has you covered. These prompt engineering courses walk you through structured prompting, evaluation, and real-world workflows with today’s leading models.

              FAQ

              Is chain of thought prompting still relevant?

              Yes, chain of thought prompting is still relevant, mainly with non-reasoning models and whenever you need reasoning you can review. Reasoning models already work through problems internally, so an explicit cue adds little accuracy there and slows responses.

              Does chain of thought prompting require retraining the model?

              No, chain of thought prompting doesn’t require retraining or fine-tuning.

              What is zero-shot chain of thought prompting?

              Zero-shot chain of thought prompting means adding a reasoning cue like “Let’s think step by step” without giving the model any examples. The model builds its own reasoning chain, which makes this the quickest version to try.

              What’s the difference between chain of thought prompting and prompt chaining?

              Chain of thought prompting asks for step-by-step reasoning inside one response, while prompt chaining splits a task across several prompts. In a chain, each prompt’s output feeds the next one, such as a summary prompt followed by an email-drafting prompt.

              1. Wharton Generative AI Labs, Prompting Science Report 2: The Decreasing Value of Chain of Thought in Prompting, https://gail.wharton.upenn.edu/research-and-insights/tech-report-chain-of-thought/ ↩︎