HomeAboutContactGuides › Chain-of-Thought Prompting
Prompt Engineering Guide

Chain-of-Thought Prompting:
Complete Guide + 40 Real Examples

Chain-of-thought (CoT) prompting is one of the most powerful techniques in prompt engineering. By asking AI models to show their reasoning step-by-step, you can dramatically improve accuracy on complex tasks — math, logic, planning, and more. Here's everything you need to know.

What Is Chain-of-Thought Prompting?

Chain-of-thought (CoT) prompting is a technique where you instruct an AI model to reason through a problem step by step before delivering its final answer. Instead of jumping directly to a conclusion, the model "shows its work" — making its reasoning process transparent and, crucially, more accurate.

The core insight: language models that are asked to explain their reasoning as they go tend to arrive at better answers than models asked for direct responses. It's similar to asking a student to show their work on a math test — the process of writing out the steps catches errors and leads to more reliable results.

❌ Without Chain-of-Thought
Prompt: "A store has 52 apples. They sell 28 and then receive a delivery of 15 more. How many do they have?"
Response: "39 apples" (Incorrect — the model skipped steps and got it wrong)
✅ With Chain-of-Thought
Same prompt + "Think through this step by step."
Response: "Step 1: Start with 52 apples. Step 2: Sell 28: 52 - 28 = 24. Step 3: Receive 15 more: 24 + 15 = 39. The store has 39 apples." (Correct)

Why Chain-of-Thought Prompting Works

Research from Google Brain (Wei et al., 2022) first formally demonstrated CoT prompting's power. The paper showed that for problems requiring multiple reasoning steps, models using chain-of-thought outperformed direct-answer models by significant margins — sometimes dramatically.

The mechanism is thought to work because:

Key finding: CoT prompting provides the biggest improvement on tasks requiring 3+ logical steps. For simple 1-step questions, the benefit is minimal or even slightly negative (adds unnecessary tokens without improving accuracy).

Zero-Shot Chain-of-Thought

The simplest form of CoT prompting requires no examples at all — just add a reasoning trigger to your prompt. The discovery that simply adding "Let's think step by step" dramatically improves accuracy was a significant breakthrough in AI research.

Zero-Shot CoT Trigger Phrases

These phrases trigger step-by-step reasoning in most modern AI models:

Proven Zero-Shot CoT Triggers (copy any of these)
1. "Let's think step by step." 2. "Think through this carefully, one step at a time." 3. "Before giving your answer, reason through this systematically." 4. "Walk me through your reasoning process." 5. "Think out loud as you work through this." 6. "Solve this step by step, showing your work." 7. "Let's break this down systematically." 8. "First, reason through the problem. Then give your final answer." 9. "Think carefully before responding. What are the steps involved?" 10. "Approach this methodically. What needs to happen first, second, third?"

Zero-Shot CoT Math Example

Zero-Shot CoT — Math Problem
Without CoT (weak): "If a train travels at 80mph for 2.5 hours, then slows to 55mph for 1.5 hours, what total distance did it travel?" With Zero-Shot CoT (strong): "If a train travels at 80mph for 2.5 hours, then slows to 55mph for 1.5 hours, what total distance did it travel? Think step by step before giving your final answer."

Few-Shot Chain-of-Thought Prompting

Few-shot CoT provides 2-3 worked examples before asking your actual question. This shows the model exactly what kind of reasoning format you want, and can significantly outperform zero-shot CoT on complex or domain-specific tasks.

Few-Shot CoT Template
Here are examples of how to solve this type of problem: Example 1: Problem: [EXAMPLE PROBLEM 1] Reasoning: Step 1: [First step]. Step 2: [Second step]. Step 3: [Third step]. Answer: [CORRECT ANSWER] Example 2: Problem: [EXAMPLE PROBLEM 2] Reasoning: Step 1: [First step]. Step 2: [Second step]. Answer: [CORRECT ANSWER] Now solve this problem using the same step-by-step approach: Problem: [YOUR ACTUAL PROBLEM] Reasoning:

Advanced CoT Variations

Tree of Thoughts (ToT)

An extension of CoT where the model explores multiple reasoning branches simultaneously and evaluates which path to continue. Useful for problems where the first approach might not work.

Tree of Thoughts Prompt Template
Imagine three different expert approaches to this problem. Each expert will: 1. Propose a different initial approach or framing 2. Think through the first 2-3 steps of their approach 3. Evaluate whether their approach is promising Then, identify the most promising approach and continue it to a full solution. Problem: [YOUR PROBLEM] Expert 1 approach: Expert 2 approach: Expert 3 approach: Best approach selected: Full solution:

Self-Consistency CoT

Ask the model to solve the problem multiple times independently and take the majority answer. Research shows this significantly improves accuracy over single-run CoT.

Self-Consistency CoT Template
Solve this problem 3 times independently, using a different approach each time. Then give me the answer that appears most frequently across the 3 attempts. Problem: [YOUR PROBLEM] Attempt 1 (step by step): Attempt 2 (different approach, step by step): Attempt 3 (verify using a third method): Most consistent answer:

Chain-of-Thought Examples by Category

Math & Quantitative Reasoning

CoT Math Prompt
A company's revenue grew 25% in Q1, declined 10% in Q2, grew 15% in Q3, and declined 5% in Q4. If they started with $1M in January, what was their December revenue? Think through each quarter step by step before giving the final answer.

Logic & Reasoning

CoT Logic Prompt
Three friends — Alice, Bob, and Carol — each have different jobs: teacher, engineer, and doctor (in some order). Alice is not the doctor. Bob is not the teacher. Carol is not the engineer. What is each person's job? Work through this step by step using elimination before giving your final answer.

Business Decision Making

CoT Business Analysis
Should [COMPANY] expand into [NEW MARKET] or focus on deepening penetration in [CURRENT MARKET]? Think through this decision step by step: first list the key factors that matter, then analyze each, then weigh them, then give your recommendation with reasoning.

Code Debugging

CoT Debugging Prompt
My code isn't working as expected. Before suggesting a fix, trace through the code step by step as if you're the computer executing it. Note what each variable's value is at each step. This will help identify where the actual bug is. [PASTE CODE HERE] Expected output: [WHAT IT SHOULD DO] Actual output: [WHAT IT'S DOING WRONG]

When to Use Chain-of-Thought (and When Not To)

Use CoT prompting when:

Don't use CoT when:

Frequently Asked Questions

What is chain-of-thought prompting?

Chain-of-thought prompting is a technique where you ask an AI model to show its reasoning step by step before delivering a final answer. This improves accuracy on complex tasks by making the reasoning process explicit and allowing the model to catch errors in intermediate steps.

Does chain-of-thought prompting work on all AI models?

CoT prompting works best on large language models (100B+ parameters) that have been instruction-tuned. It works well on GPT-4, Claude 3.5, Gemini 1.5 Pro, and similar flagship models. On smaller or older models, the benefit is less consistent.

What is the difference between zero-shot and few-shot CoT?

Zero-shot CoT adds a phrase like "think step by step" to your prompt without examples. Few-shot CoT provides 2-3 worked examples showing the exact reasoning format you want before asking your question. Few-shot CoT generally produces more consistent results but requires more prompt engineering effort.

Practice CoT Prompting with Our Free Tool

Build custom chain-of-thought prompts for any use case with our AI-powered generator.

Try the Free Prompt Generator ↗