System prompt vs user prompt: what goes where, and why it matters
TL;DR: A system prompt sets the standing rules for a whole conversation: who the assistant is, what it may do, its tone and its facts. A user prompt is the request of the moment. When they conflict, models are trained to follow the system or developer prompt. The system prompt is sent again with every message.
The difference in one minute
Every conversation with an AI model is a list of messages, and each message has a role. The system prompt (OpenAI's API now calls it the developer message) comes first and sets the rules for everything after it. The user prompt is what a person types in each turn. The model's own replies have a third role, assistant.
Think of a new employee. The system prompt is the briefing on day one: what the company does, who the customers are, what you may and may not promise, how to sound. The user prompt is the customer at the counter asking a question. The briefing doesn't change from customer to customer. The questions do.
| System prompt | User prompt | |
|---|---|---|
| Who writes it | The developer, or you when you set up a project or custom instructions | Whoever is chatting, each turn |
| How long it lasts | The whole conversation | One turn |
| What it holds | Role, rules, tone, standing facts, output format | The task, the question, the material to work on |
| Priority when they conflict | Higher | Lower |
| Cost | Sent again with every message | Sent once, then carried in the history |
What belongs in each
The test is simple: if it should still be true on the tenth message, it belongs in the system prompt. If it only matters for this request, it belongs in the user prompt.
Put these in the system prompt
- The role. One line on who the assistant is and who it serves. See role prompting for how much a single line changes.
- Rules that must always hold. What it must never promise, never ask for, or never invent.
- Standing facts. Your policies, product details, prices, opening hours: anything every answer may need.
- Tone and format defaults. Length, structure, reading level, language.
- What to do when it doesn't know. Say so, ask, or hand over to a person.
Put these in the user prompt
- The task. Write, answer, summarize, compare.
- The material. The email to reply to, the document to read, the data to check.
- One-off details. The customer's name, an order number, a deadline.
- Exceptions. "This time, make it longer" is fine in a user prompt, as long as it doesn't break a rule in the system prompt.
A common mistake runs the other way: pasting the same paragraph of background into every chat. If you type it more than twice, it is a system prompt in disguise. Move it into custom instructions or a project, as described below.
How ChatGPT, Claude and Gemini expose them
In the chat apps you never see or edit the real system prompt. The vendor writes its own. What you get instead are standing instructions that apply to every chat, or to every chat in one project. In the APIs, you write the system prompt yourself.
| Tool | In the API | In the chat app |
|---|---|---|
| ChatGPT (OpenAI) | A message with the developer role, or the instructions parameter in the Responses API | Custom instructions (all chats) and project instructions (chats in that project) |
| Claude (Anthropic) | The top-level system parameter of the Messages API | Instructions for Claude in settings (all chats) and project instructions (chats in that project) |
| Gemini (Google) | The system_instruction parameter | Your instructions for Gemini, under Personal context (all chats), and each Gem's own instructions |
Google's help pages say that from November 2026, Gems on personal Google accounts move over to skills. Menu names in all three apps change often, so check the app if a label doesn't match.
Two API details trip people up. OpenAI's docs describe developer messages as instructions from the application developer, "prioritized ahead of user messages". And in OpenAI's Responses API, the instructions parameter only applies to the current request: if you chain turns with previous_response_id, you have to send the instructions again each time. For a Claude-only deep dive, see how to write a Claude system prompt; for ChatGPT's app settings, see ChatGPT custom instructions.
Which one wins: the instruction hierarchy
When a system prompt and a user prompt disagree, current models are trained to side with the system prompt. OpenAI has published this in two places.
In April 2024, OpenAI researchers published The Instruction Hierarchy. Their argument: many attacks, such as prompt injections and jailbreaks, work because models give a developer's system prompt the same priority as text from an untrusted user or a third party. They trained GPT-3.5 to ignore lower-priority instructions that conflict with higher ones, and report much better robustness, including against attacks not seen in training, with little loss of normal ability.
OpenAI's Model Spec, the public document describing how its models should behave, turns this into a "chain of command". The current version gives each source a default level of authority, from highest to lowest:
- Root: rules in the Model Spec itself that nothing in a conversation can override.
- System: system messages from OpenAI.
- Developer: developer messages, the system prompt you write in the API.
- User: user messages.
- Guideline: defaults in the Model Spec that the context can override.
Below all of these sit sources with no authority by default: the model's own earlier replies, tool results, quoted text and files. An instruction hidden inside a pasted document or a web page is data, not a command. The spec also says a later instruction at the same level replaces an earlier one, so a user who changes their mind mid-chat is followed.
What this means for you:
- Put the rules that must hold in the system prompt, not in the first user message. A later user message can replace an earlier one; a user message is not supposed to override the system prompt.
- Treat the hierarchy as a strong default, not a lock. The research reports better robustness, not perfect obedience, so don't put secrets in a system prompt and assume no one can get them out.
- Anthropic and Google document their system prompt parameters but describe priority in less detail, so test conflicts in the model you use.
A worked example, split into both
Here is the kind of single prompt most people start with. It is for a made-up online plant shop called Fernleaf.
You are the customer support assistant for Fernleaf, an online shop that sells houseplants and pots in the UK. Be friendly and plain and keep it under 120 words. Never promise refunds or discounts. Delivery is 2 to 4 working days, plants can't be returned but damaged ones are replaced if the customer sends a photo within 7 days. A customer wrote: "Hi, my monstera arrived yesterday and two of the leaves are torn. Order 48213. Can I get a new one?" Write the reply.It works once. But for the next customer you have to paste all of it again, the rules are mixed in with the request, and nothing says what to do when the answer isn't in the facts. Split it: the parts that stay the same become the system prompt, and only the customer's message is left for the user prompt.
You are the customer support assistant for Fernleaf, an online shop that sells houseplants and pots in the UK.
Who you talk to: customers who have ordered, or are about to. Most are not plant experts.
What you help with: order status, delivery, returns, plant care and choosing a plant for a room.
Rules:
- Use only the facts in the policy below. If the answer is not there, say so and offer to pass the question to the team.
- Never promise refunds, discounts or delivery dates. A person on the team decides those.
- Never ask for card details or passwords.
- If the customer is upset, acknowledge the problem in one sentence before you answer.
Style: friendly and plain. Short paragraphs. Under 120 words unless the customer asks for more detail.
Policy:
- Delivery: 2 to 4 working days in mainland UK. Orders placed before 1pm ship the same day.
- Returns: unused pots within 30 days. Plants can't be returned, but if one arrives damaged, the customer sends a photo within 7 days and we send a replacement.
- Every order includes a printed care card for each plant.Hi, my monstera arrived yesterday and two of the leaves are torn. Order 48213. Can I get a new one?The system prompt is longer than the original, and that is the point. It now covers the next hundred customers, not just this one. It says what to do when a fact is missing, and the rules sit apart from anything a customer can type.
To build your own, start from this template and fill in the brackets.
You are [role] for [company or team], which [what it does, for whom].
Who you talk to: [the people sending messages, and what they know].
What you help with: [the tasks in scope]. For anything else, [what to do].
Rules:
- Use only the facts below. If the answer is not there, [say so / ask / hand over to a person].
- Never [the things it must not promise, ask for or invent].
Style: [tone], [length], [format].
Facts:
- [policy, price, product detail or deadline]
- [another one]What a system prompt costs over a conversation
Models don't remember. With each new message, the app or your code sends the whole conversation again: the system prompt, every earlier message and the new one. So the system prompt is paid for on every turn, not once.
We measured the example above with OpenAI's o200k_base tokenizer, the one GPT-5, GPT-4.1 and GPT-4o use. The system prompt is 237 tokens. The table shows how many system prompt tokens one conversation sends, next to a 2,000-token system prompt, about the size you get after pasting a full FAQ into it.
| Turns in the conversation | 237-token system prompt | 2,000-token system prompt |
|---|---|---|
| 1 | 237 | 2,000 |
| 5 | 1,185 | 10,000 |
| 10 | 2,370 | 20,000 |
| 20 | 4,740 | 40,000 |
| 50 | 11,850 | 100,000 |
That is before the history, which also grows every turn. Multiply by a thousand conversations a month and a padded system prompt becomes a real line on the bill, and more for the model to read before every reply.
Three ways to keep it down:
- Cut what doesn't change answers. Politeness, repeated rules and background the model never uses cost tokens on every turn. Paste your system prompt into our free token counter to see its real size before and after you trim it.
- Move rarely needed facts out. A full returns policy can live in a document the assistant looks up when asked, rather than in every message. That is the core idea of context engineering.
- Keep it stable and at the start. OpenAI and Anthropic both offer prompt caching, which charges a fraction of the normal price for an opening part of the prompt that repeats exactly. On OpenAI it is on by default for supported models; on Anthropic you turn it on in the request. Either way, a system prompt that changes every turn can't be cached.
Common mistakes
- Putting rules in the first user message. They fade as the chat goes on and a later message can replace them. Rules go in the system prompt.
- Putting the task in the system prompt. "Write a reply to this email" in a system prompt makes every turn about that email. Keep the system prompt about how to work, not what to do right now.
- Writing the system prompt as a wall of capital letters. Shouting is not the same as explaining. Anthropic's docs note that recent Claude models respond more strongly to the system prompt, and suggest plain wording such as "Use this tool when..." over "CRITICAL: You MUST". Give the reason instead: "Don't promise refunds, because a person approves them."
- No instruction for missing facts. Without one, the model fills the gap with something plausible. Say what to do instead.
- Never testing a conflict. Type a user message that breaks a rule and see what happens. That is the quickest check that your system prompt does its job.
Let the right experts write your prompt
Prompt Expert is an AI prompt generator that brings the right experts to every job. They ask a few questions, read your website and files, and write the prompt for ChatGPT, Claude or Gemini with your real facts, working together when a job needs more than one.
See how it worksQuestions
What is the difference between a system prompt and a user prompt?
A system prompt sets the standing rules for a whole conversation: role, limits, tone and facts. A user prompt is the specific request in one turn. The system prompt is written once and applies to every reply; the user prompt changes each time.
Does the system prompt override the user prompt?
Usually, yes. OpenAI trains its models to give developer and system messages priority over user messages when they conflict, and documents this in its Model Spec. It is a strong default rather than a guarantee, so test the conflicts that matter to you.
Can I set a system prompt in ChatGPT, Claude or Gemini without the API?
Not the real one, but you can add standing instructions. ChatGPT has custom instructions and project instructions, Claude has instructions in settings and project instructions, and Gemini has your instructions for Gemini and Gem instructions.
How long should a system prompt be?
As long as it needs to be to cover the rules and facts every answer depends on, and no longer. It is sent with every message, so each extra line is paid for on every turn. Measure it with a token counter and cut anything that doesn't change answers.
Is a developer message the same as a system prompt?
In OpenAI's API, yes in practice: the developer message is where you put what used to be called the system prompt. OpenAI's Model Spec reserves the system level for OpenAI's own instructions and ranks developer messages just below them, above user messages.
Should examples go in the system prompt or the user prompt?
If the examples show the format or tone for every reply, put them in the system prompt. If they only apply to one task, put them in the user prompt with that task.
Sources
- OpenAI: Model Spec, the chain of command
- Wallace et al. (OpenAI): The Instruction Hierarchy, 2024
- OpenAI: Text generation and message roles
- Anthropic: Prompting best practices, give Claude a role
- Google: Text generation and system instructions in the Gemini API