AI Prompt Builder
Build a clear prompt for ChatGPT, Claude or Gemini from role, task, context, examples and output format, with XML or Markdown sections and a token count.
The interactive tool loads here when JavaScript runs.
About this toolWhat is the AI Prompt Builder?
A good prompt answers the questions a capable new colleague would ask before starting: what is the task, why does it matter, who is it for, what material do I work from, what should the result look like. The AI Prompt Builder turns those answers into a clean, sectioned prompt you can paste into ChatGPT, Claude, Gemini or an API call.
Fill in a role, the task, background, audience, constraints and the input material, add a few example input and output pairs, then choose the output format (plain text, Markdown, JSON with a schema, or a table with named columns), a tone and a length. The preview updates as you type, with an exact token count. Seven starting templates cover summarising, extracting to JSON, rewriting, classifying, code review, brainstorming and meeting notes.
- Role, task, context, audience, constraints and input fields
- Few-shot examples as input and output pairs
- Output as plain text, Markdown, JSON with schema or a table with named columns
- XML-tagged or Markdown-heading sections
- Optional system and user message split, JSON messages download
- Seven starting templates and a live token count
Updated
How to use the AI Prompt Builder
- Pick a template close to your job, or press Blank to start from nothing.
- Write the role and the task. Start the task with an action verb and say what a finished answer contains.
- Add context: why you need the output, where it will be used and what good looks like. Name the audience.
- Paste the material to work on into Input, or leave a {{PLACEHOLDER}} if you are building a reusable template.
- Add one to three examples if the output must follow an exact format or label set.
- Choose the output format, tone, length and section style (XML tags or Markdown headings). Turn on the system prompt split for API use.
- Copy the prompt, download it as text, or download a JSON messages array ready for an API request.
Worked examples
Extracting invoice fields to JSON
Input
Template "Extract data to JSON", one example email, schema with vendor, invoice_number, dates, currency and total
Output
A prompt with <context>, <input>, <examples>, <instructions> and <output_format> sections, ending in "Return only valid JSON that matches this schema"
The worked example fixes the date format (YYYY-MM-DD) and the number format for totals, which a description alone often fails to pin down.
Splitting system and user messages
Input
Role "support ticket triage assistant", constraints on three lines, split turned on
Output
System: the role sentence plus a <constraints> list. User: context, ticket, examples, task and output format
Standing rules sit in the system prompt so they apply to every ticket; each request then carries only the ticket.
Background and insight
Every major vendor publishes prompting advice, and it converges on the same handful of habits. Anthropic's guide for Claude says to be clear and direct, to give context and the reason behind an instruction, to include examples (it suggests 3 to 5 for best results), and to separate instructions, context, examples and input with XML tags such as <instructions> and <context> so the model does not mistake data for orders. It also recommends putting long documents near the top of the prompt and the question at the end, noting that queries at the end improved response quality by up to 30 percent in its tests with complex, multi-document inputs.
OpenAI's and Google's guides make the same points in different words: specify the output format, show examples of it, and describe the audience and length rather than leaving them to the model. XML tags are not special syntax to any model; they are simply unambiguous delimiters. Markdown headings work too, and GPT and Gemini models read both styles well. The builder supports either and keeps the order the guides recommend: role, context, input material and examples first, then the task, rules and output format.
A system prompt is a separate message that API users can send before the conversation. It suits standing instructions that apply to every turn, such as the role and rules. Chat apps without a system field work fine with everything in one message, which is the default here.
Common use cases
Repeatable workflows
Build a template once for meeting notes, ticket triage or release notes and reuse it with new input each time.
Structured extraction
Pull fields from emails, contracts or receipts into JSON that your code can parse.
Prompts for an app
Draft the system prompt and user message for an API integration and download them as a messages array.
Teaching prompt writing
Show a team what a complete prompt contains, section by section, instead of one long paragraph.
Tips and limitations
- Write constraints as what to do, with the reason: "Keep it under 80 words because it shows in an SMS" works better than "DON'T write long answers".
- Examples are copied closely. Make them varied and correct, or the model will reproduce their mistakes and quirks.
- A JSON schema in the prompt guides the model, but only an API feature such as structured outputs or a validator in your code guarantees valid JSON.
- Long input goes before the task. If you paste a 30-page report after the question, move it into the Input field.
- The token count uses OpenAI's o200k_base encoding. Claude and Gemini tokenise differently; use the LLM Token Counter for a side-by-side view.
- The prompt is assembled in your browser and is not sent anywhere.
Frequently asked questions
Why does the prompt builder use XML tags?
Anthropic recommends XML tags for Claude because they separate instructions, context, examples and input unambiguously. They are plain text delimiters, so GPT and Gemini models handle them well too. Switch to Markdown headings if you prefer.
How many examples should a prompt include?
For an exact format or label set, one to three good examples usually fix the shape. Anthropic suggests 3 to 5 for best results on harder tasks. Make them varied so the model does not copy one example's quirks.
What should go in a system prompt instead of the user message?
Put the role and standing rules that apply to every turn in the system prompt, and the material and request for this turn in the user message. Turn on the split to see both.
Where should a long document go in a prompt?
Before the question and instructions. Anthropic reports that putting the query at the end of long, multi-document prompts improved answer quality by up to 30 percent in its tests. The builder places Input before the task automatically.
Does the builder send my prompt to an AI model?
No. It only assembles text in your browser. Copy the result into the chat app or API of your choice.
Can I use the generated prompt with ChatGPT, Claude and Gemini?
Yes. The prompt is plain text. Chat apps take the combined version; APIs can take the system and user parts separately using the downloaded JSON.
Is there an in-depth guide to the AI Prompt Builder?
Yes. “How to Write Better AI Prompts: Structure, Examples and Format” covers the background, how it works, common pitfalls and worked examples. Read the full guide.
Related Tools You May Like
Free, in-browser tools that pair well with this one.