# <thinking> tag — Claude XML prompting reference

> How to use the <thinking> XML tag in Claude prompts: when to use it, when not to, minimal and full examples, common mistakes.
>
> Source: https://claudexml.com/tags/thinking/ · Last updated 2026-05-25

Home / Tags / <thinking>

# <thinking> — when and how to use it in Claude prompts

    Tell Claude to think inside  tags before answering — the canonical CoT pattern.

    Scratchpad region where Claude is asked to reason step-by-step before producing the final answer.


## When to use `<thinking>`


- Any non-trivial reasoning task — math, multi-step logic, planning, ambiguous classification.
- When you want to inspect the model's reasoning during debugging.


## When not to use it


- Trivial classification or lookup tasks — adds latency for no gain.
- When using Claude's native extended-thinking feature via the API — that uses its own mechanism; you don't also need a `<thinking>` tag in the prompt.


## Minimal example


```xml
<instructions>
Think step by step inside <thinking> tags, then give your answer inside <answer> tags.
</instructions>

What is 17 * 23?
```


## Full example


```xml
<instructions>
You will be given a logic puzzle. First, think through the constraints inside
<thinking> tags. List what you know, what you can deduce, and any dead ends.
Then give the final answer inside <answer> tags. The answer should be one sentence.
</instructions>

<puzzle>
Three friends — Alex, Blair, and Casey — each ordered a different drink:
coffee, tea, or juice. Alex didn't order coffee. Blair didn't order tea.
Casey ordered tea. What did each person order?
</puzzle>
```


## Common mistakes


- Forgetting to also specify `<answer>` — without it, the user-facing reply may contain the entire scratchpad.
- Reading `<thinking>` output as ground truth. It's a reasoning aid, not a verified log.


Cite this page

`<thinking> — When and How to Use in Claude Prompts. claudexml.com. https://claudexml.com/tags/thinking/`
