Chain-of-Thought Prompting: Complete Guide with Examples (2026)

Last updated 2026-06-29 · Works with ChatGPT, Claude, Gemini
Quick Answer

Chain-of-Thought (CoT) prompting instructs the AI to show its reasoning process step by step before delivering a final answer. It dramatically improves accuracy on reasoning, math, logic, and multi-step analysis tasks by forcing the model to work through the problem rather than guess at the answer.

What Is the Chain-of-Thought Framework?

Chain-of-Thought prompting was introduced by Google researchers in 2022 and has since become one of the most widely used techniques in prompt engineering. Instead of asking for a direct answer, you explicitly instruct the AI to think through the problem step by step. This single change often converts a wrong answer into a correct one on tasks that require reasoning.

Fields

R
Role
The expert persona. Sets domain knowledge and reasoning style. Example: You are a senior financial analyst.
T
Task
The specific problem to reason through. Be concrete — vague tasks produce vague chains of thought.
Think step by step
The core CoT instruction. Tell the AI to show its reasoning at each stage before reaching a conclusion. Example: Think through this step by step. Show your work.
O
Output format
What the final answer should look like after the reasoning is complete. Separates the thinking from the deliverable.
+R
Rules
Hard constraints — e.g. State any assumptions explicitly. Use only the data I provide.

When to Use Chain-of-Thought

Use Chain-of-Thought when your task involves reasoning, math, logic puzzles, multi-step analysis, or any situation where the AI might jump to a wrong conclusion if it doesn't think first. It is less useful for simple lookup tasks or creative writing where reasoning steps add no value. For tasks requiring tool use in a loop, use ReAct instead.

Examples

Financial analysis
Role: You are a senior SaaS financial analyst.
Task: Based on the figures below, determine whether we will reach profitability before we run out of runway. MRR: €18,000. Monthly burn: €24,000. Cash in bank: €180,000. MRR growth rate: 15% month-over-month.
Think step by step: Think through this step by step. Calculate runway first, then project MRR growth month by month, then identify the crossover point.
Output format: Show your month-by-month table, then finish with a clear Yes/No verdict and the exact month profitability is reached.
Logic problem
Role: You are a careful logical reasoner.
Task: Alice is older than Bob. Bob is older than Charlie. Is Alice older than Charlie?
Think step by step: Work through this step by step, stating each inference explicitly before reaching your conclusion.
Output format: Final answer: one sentence only.
Code debugging
Role: You are a senior Python engineer.
Task: The function below is supposed to return the second largest number in a list but sometimes returns the wrong value. Identify why.
Think step by step: Trace through the function step by step with a sample input where it fails. Identify the exact line causing the bug.
Output format: Show your trace, name the bug, then provide the fixed function.

Compared to Other Frameworks

CoT vs RACE: RACE asks for a direct output; CoT adds explicit step-by-step reasoning before that output — use CoT when the reasoning path matters. CoT vs RISEN: RISEN defines a fixed sequence of steps for the AI to follow; CoT asks the AI to generate its own reasoning chain. CoT vs ReAct: ReAct adds tool use and observation loops; CoT is for single-pass reasoning without external tools.

Save Chain-of-Thought prompts in Promptary — free

Save your first prompt in the structured editor and get a permanent REST API endpoint. Personal plan is free forever, no credit card required.

Start free

Frequently Asked Questions

What is Chain-of-Thought prompting?

Chain-of-Thought (CoT) prompting instructs an AI model to reason through a problem step by step before giving a final answer. It was introduced by Google researchers in 2022 and significantly improves accuracy on reasoning and math tasks.

Does Chain-of-Thought work with Claude, GPT-4, and Gemini?

Yes. CoT works with all major language models. The technique is model-agnostic — any model capable of following instructions benefits from explicit step-by-step reasoning prompts.

What is the difference between zero-shot and few-shot Chain-of-Thought?

Zero-shot CoT uses a simple instruction like 'think step by step' with no examples. Few-shot CoT provides worked examples showing both the reasoning chain and the final answer. Few-shot CoT generally produces more structured reasoning but requires more prompt writing.

When should I not use Chain-of-Thought?

Skip CoT for simple factual lookups, creative writing, and short tasks where reasoning steps add no value and just increase output length. CoT is most valuable when the risk of jumping to a wrong conclusion is high.