# Prompt Delimiters and Tags

> How tags and other delimiters keep your instructions apart from the text the model works on. Where to put each part, and what a tag cannot stop.

**Course:** [Prompt Engineering](https://learn.benibix.com/learn/ai-working-with-ai)  
**Time:** 10 min

**After this lesson you can:**

- Fence off pasted text with named tags
- Order a long prompt so the question comes last
- Explain why tags do not stop prompt injection

## How tags keep the parts of a prompt apart

A prompt delimiter is a mark that fences off one part of a prompt from another. Triple quotes, lines of hash marks and tags such as <email> and </email> all work. They tell the model where your instructions end and where the text it should work on begins.

This matters most when you paste in something long or written by someone else. A three-page contract, an email or a web page can all hold lines that sound like orders. Inside a fence, the model is far more likely to treat them as text to work on.

Tags are the most common choice with chat models. Give each one a plain name that says what it holds: contract, notes, question. Use the same names every time, and close every tag you open. Then you can point at a part by name, such as sum up the text in the contract tags.

Order helps too. Put long documents near the top and your question at the end. Models tend to use the start and the end of a long input best. A question asked after the text it is about is often answered better than one asked before it.

Tags work on the way out as well. Ask for the answer inside answer tags, and your code can cut out exactly that part. Ask for notes in one tag and the answer in another, and you can keep the notes for yourself and show only the answer.

A fence helps the model, but it is not a lock. A clever line inside the fenced text can still steer the model. That trick is called prompt injection. A fence lowers the risk. Limiting what the app is allowed to do is what keeps the damage small.

Do not overbuild it. A one-line question needs no tags. Tags pay off once a prompt has two or more parts that could be mixed up: rules and data, examples and the real task, or two documents to compare.

```text
<email>
Hi team, the launch moves from 3 June to 10 June.
Please send your slides by 6 June.
</email>

Sum up the email in the email tags in two sentences.
Then list every date it mentions.
```
The pasted email sits inside its own tags at the top. The request comes last, after the text it is about.

![A prompt with the task at the top. Below it, a pair of tags fences off an article. Inside the article, one line tells the model to ignore the task, and a note beside it says the line is read as text.](https://learn.benibix.com/diagrams/pr-prompt-delimiter.svg)

### Example: Jack sums up customer emails

Jack's tool sums up customer emails. One test email ends with a line telling the model to reply in French. With no tags, 4 of his 20 test summaries come back in French.

He puts each email inside email tags and moves his request below them. Only 1 of the 20 goes wrong now. He also makes sure the tool cannot send any email on its own.

**Words in this lesson:** [Prompt Delimiter](https://learn.benibix.com/term/ai/prompt-delimiter), [Prompt Injection](https://learn.benibix.com/term/ai/prompt-injection)

**Question:** Do tags around pasted text stop prompt injection?

**Answer:** No, they lower the risk but are not a lock. Tags help the model tell your rules from the pasted text. A clever line can still slip through, so limit what the app can do as well.

---

Source: https://learn.benibix.com/learn/ai-working-with-ai/prompt-delimiters-and-tags
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-20
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
