# <answer> tag — Claude XML prompting reference

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

Home / Tags / <answer>

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

    Combined with , lets you parse the final response with a trivial regex.

    Wrapper for the final, user-facing answer. Almost always paired with `<thinking>`.


## When to use `<answer>`


- You want to programmatically extract the answer (regex on `<answer>...</answer>`).
- You're using chain-of-thought and need to hide or separately render the scratchpad.


## When not to use it


- When the entire response is the answer — no need to wrap it.


## Minimal example


```xml
<answer>42</answer>
```


## Full example


```xml
<instructions>
Think inside <thinking> tags. Put the final classification (one of: bug, feature,
question, other) inside <answer> tags.
</instructions>

<ticket>{{ user_ticket }}</ticket>
```


## Common mistakes


- Trying to put structured data inside `<answer>` while also asking for a different format outside it. Pick one location for the final output.


Cite this page

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