AI Prompt Optimizer
Assemble a structured prompt from role, context, rules, examples and output format, each in its own XML-style tag.
Runs in your browser. Nothing you add is uploaded.
What the AI Prompt Optimizer does
This is a prompt builder, not an AI that rewrites your text. You fill in the parts of a well-structured prompt (the role the model should take, background context, the specific goal, rules and things to avoid, how to reason, examples, and the output format) and it assembles them into one prompt with each part wrapped in its own XML-style tag, such as <role>, <context> and <rules>. Empty sections are left out. Model providers, Anthropic in particular, recommend tagged sections for long prompts because they keep instructions, background and data clearly apart. Three templates (code reviewer, data extraction, docs writer) show filled-in examples.
How to build a structured prompt
- Pick a template, or clear the fields and start your own.
- Fill in the sections you need: role, context, objective, rules, thinking process, examples and output format.
- Keep Include {{USER_INPUT}} Placeholder switched on if your code will insert user data; it adds an <input_data> block at the end.
- Copy the assembled prompt into your system prompt, API call or chat.
The AI Prompt Optimizer runs entirely in your browser — nothing you enter is uploaded, stored, or logged.
When to use it
Turning a one-line request into a reusable prompt
'Review this code' gets a generic answer. Stating the role (senior reviewer for a TypeScript API), the context (Node 20, PostgreSQL), the objective (find security and performance problems), the rules (cite line numbers, skip style nitpicks) and the output format (a table of severity, line and fix) gets a focused, consistent one, and the same prompt can be reused next time.
Keeping user data apart from instructions
When an app inserts text from users or documents into a prompt, putting it in its own tag at the end, as the {{USER_INPUT}} option does, and telling the model in the rules to treat that block as data makes it harder for text inside a document to be taken as instructions. It reduces prompt-injection risk; it does not remove it.
Sharing prompts across a team
Sections with fixed names make prompts easier to review: a teammate can tighten the rules or swap the examples without rewriting everything, and the differences between versions are easy to see in a diff.
Good to know
- Examples are the strongest signal for output format. One or two realistic input and output pairs usually do more than a paragraph describing the format.
- Say what to do as well as what to avoid: 'Write for a non-technical reader' works better than 'Don't use jargon' on its own.
- Ask for step-by-step reasoning only when the task needs it (multi-step logic, maths, code review). For simple lookups it just makes answers longer and costlier.
- The tag names are a convention, not syntax the model requires. What matters is that each section is clearly delimited and consistently named.
- Nothing is sent anywhere; the builder only joins your text together in the browser.
Frequently asked questions
Why use XML tags in AI prompts?
What is a negative constraint in prompt engineering?
Why use XML tags instead of Markdown headings?
What is chain-of-thought prompting?
Does this tool rewrite or optimise my prompt?
Page last updated . Found a wrong result or a mistake on this page? Let us know.
Related tools
AI Code & Formula Explainer
Plain-English explanations of formulas, calculations and code.
Optional cloud mode
AI Text Rewriter
Rewrite text in a professional, friendly, concise or formal tone.
Optional cloud mode