Skip to contentNew: Does ChatGPT recommend your brand? Free 60-second AI visibility check →
By The DDH Team · Digital Dashboard Hub

System Prompt vs User Prompt: What's the Difference? (2026)

The system prompt sets the model's persistent role, rules, and behavior for the whole conversation. The user prompt is the specific request on a single turn. Putting the right instruction in the right place is one of the highest-leverage habits in prompt engineering.

By The DDH Team at Digital Dashboard HubUpdated

In short: the system prompt defines how the model should behave (its role, rules, tone, and constraints) across the entire conversation, while the user prompt is the specific task or question on a given turn. The system prompt is set once and persists; the user prompt changes every message. Get this split right and you reduce repetition, improve consistency, and make outputs more controllable.

Both major vendors document this two-role structure — see OpenAI's prompt engineering guide and the Claude prompt engineering overview. Below we define each, show code, and cover when each matters. To draft both well, try our free ChatGPT Prompt Generator.

Digital Dashboard Hub

Writing good prompts for ONE AI is hard. Writing them for GPT-5, Claude, Gemini, Perplexity, Midjourney and 6 more is a full-time job. DDH's AI Prompt Builder writes once, runs everywhere — locked to your niche, voice, and brand tone.

Free 14 days, no card.

System prompt vs user prompt — at a glance

Feature
System prompt
User prompt
PurposeDefines role, rules, tone, and behaviorThe specific request or question this turn
PersistencePersists across the whole conversationChanges every message
Set byDeveloper / app builder (usually)End user (usually)
Typical contentPersona, hard rules, output format, constraintsThe task, question, or data to process
API placementsystem role (OpenAI) or system parameter (Anthropic)user role message
Should it contain secrets?No — assume it can leak (OWASP LLM07:2025)No — treat as untrusted input

Sources: OpenAI prompt engineering — https://platform.openai.com/docs/guides/prompt-engineering and chat API reference — https://platform.openai.com/docs/api-reference/chat ; Claude prompt engineering overview — https://docs.claude.com/en/docs/build-with-claude/prompt-engineering/overview ; OWASP LLM Top 10 — https://genai.owasp.org/llm-top-10/ . As of June 15, 2026.

What is a system prompt?

A system prompt is a persistent instruction that establishes the model's role, behavior, rules, tone, and output format for the whole conversation. You set it once, and it shapes every response that follows. It answers "who is the model and how should it act?" rather than "what do I want right now?"

Typical system-prompt content: the assistant's persona ("You are a senior tax accountant"), hard rules ("Never give legal advice; always cite the IRS form number"), tone ("Be concise and formal"), and output format ("Respond in JSON with keys summary and steps"). Here is a minimal example:

``` You are a customer-support assistant for an e-commerce store. Rules: - Be concise, friendly, and professional. - Never promise refunds; direct refund requests to the returns policy. - If you don't know an answer, say so and offer to escalate. Format: 2-3 short sentences, no bullet lists. ```


What is a user prompt?

A user prompt is the specific request or question on a single turn — the actual task you want done right now. It changes with every message and operates within the constraints the system prompt established. It answers "what do I want this time?"

Against the support system prompt above, a user prompt might be:

``` A customer writes: "My order #4821 hasn't shipped after 6 days. What's going on?" Draft a reply. ```

The model combines the two: the system prompt tells it to be concise, friendly, and to avoid promising refunds; the user prompt gives it the specific situation to respond to. Same system prompt, thousands of different user prompts.


When does each one matter?

Put durable, conversation-wide instructions in the system prompt: role, rules, tone, safety constraints, and output schema. These are things you don't want to repeat on every turn, and that should apply consistently no matter what the user asks.

Put the specific, changing request in the user prompt: the actual question, the data to process, the one-off formatting tweak. A common mistake is stuffing role and rules into every user message — that's repetitive and inconsistent. Another is putting per-task data in the system prompt — that bloats it and reduces flexibility.

Rule of thumb: if an instruction should apply to the whole conversation, it belongs in the system prompt; if it only applies to this one message, it belongs in the user prompt. For technique on writing both, the free DAIR.ai Prompt Engineering Guide and Learn Prompting are good references.

Use the system prompt for: role, persistent rules, tone, safety constraints, and output format — anything that should hold across the entire conversation. Set once.
Use the user prompt for: the specific task, question, or data for this turn — anything that changes message to message. Set every turn.


How does this look in an API call?

Both OpenAI and Anthropic expose the two roles in their chat APIs. The structure is a list of messages where one carries the system instruction and the rest are the user (and assistant) turns. Conceptually:

``` messages = [ { "role": "system", "content": "You are a concise SQL tutor. Explain, then show one example query." }, { "role": "user", "content": "How do I find duplicate emails in a users table?" } ] ```

Anthropic's Messages API takes the system instruction as a top-level system parameter rather than a message, but the concept is identical. See the OpenAI chat API reference and the Claude prompt engineering overview for the exact shapes.


What are the security implications? (System prompt leakage)

System prompts often contain rules, business logic, or configuration that you may not want exposed. The OWASP Top 10 for LLM Applications lists this as a real risk: LLM07:2025 System Prompt Leakage, where an attacker coaxes the model into revealing its system prompt. The related and higher-ranked LLM01:2025 Prompt Injection covers attempts to override system instructions with malicious user input. See the OWASP LLM Top 10.

Two practical takeaways. First, never put secrets (API keys, passwords, raw credentials) in a system prompt — assume it can leak. Second, don't rely on the system prompt alone for security; treat user input as untrusted and enforce sensitive rules with real controls (authorization, validation, guardrails) outside the model, because a determined prompt-injection attack can try to override system instructions.

Frequently Asked Questions

What is the difference between a system prompt and a user prompt?

The system prompt sets the model's persistent role, rules, tone, and output format for the whole conversation; the user prompt is the specific request or question on a single turn. The system prompt is set once and persists; the user prompt changes every message. Both are documented in OpenAI's and Claude's prompt guides.

Do I always need a system prompt?

No. Many casual chat interactions work fine with just user prompts and a sensible default behavior. A system prompt becomes valuable when you need consistent role, tone, rules, or output format across many turns — for example in a product where every response must follow the same constraints. For one-off questions, a well-written user prompt is often enough.

What should go in the system prompt vs the user prompt?

Put durable, conversation-wide instructions in the system prompt: role, rules, tone, safety constraints, and output schema. Put the changing, specific request in the user prompt: the actual question, the data to process, or a one-off formatting tweak. Rule of thumb — if it should apply to the whole conversation, it's a system prompt; if it's just for this message, it's a user prompt.

Can a user prompt override a system prompt?

It can try — that's the core of prompt injection. The OWASP LLM Top 10 lists LLM01:2025 Prompt Injection as the #1 risk, where malicious user input attempts to override system instructions. System prompts carry weight but are not a hard security boundary, so don't rely on them alone for sensitive rules — enforce those with real controls outside the model.

Is it safe to put rules or secrets in a system prompt?

Rules, yes — that's what system prompts are for. Secrets, no. The OWASP Top 10 flags LLM07:2025 System Prompt Leakage, the risk that an attacker extracts the system prompt. Never put API keys, passwords, or other credentials in a system prompt; assume it can be revealed and keep secrets in proper secret storage.

How do system and user prompts appear in the API?

In OpenAI's chat API, messages have roles — one message with role 'system' carries the instruction and the rest are 'user' (and 'assistant') turns; see the chat API reference. Anthropic's Messages API takes the system instruction as a top-level 'system' parameter and the conversation as user/assistant messages. The concept is the same in both.

Does the system prompt count toward token cost?

Yes. The system prompt is sent with every request and counts as input tokens each turn, so a long system prompt adds up over a conversation. Prompt caching can reduce this cost when the system prompt is reused — Anthropic, for example, prices cache reads at 10% of base input (see Claude pricing). Keep system prompts focused: durable rules only, not per-task data.

Write better system and user prompts

Use our free [ChatGPT Prompt Generator](/chatgpt-prompt-generator) to structure both — role and rules for the system prompt, the specific task for the user prompt. No signup required.

Browse all prompt tools →