Prompt Formatter Online

Format prompts into OpenAI, Anthropic, and Gemini message structures

#1
#2
OpenAI FormatGPT-4o / GPT-4 Turbo
{
  "model": "gpt-4o",
  "messages": [
    {
      "role": "system",
      "content": ""
    },
    {
      "role": "user",
      "content": ""
    }
  ]
}

~39 estimated tokens · use the Token Counter for an exact count

Format differences

OpenAI

system / user / assistant all in messages[]

Anthropic

system is a top-level field; conversation in messages[]

Gemini

system_instruction at root; assistant renamed to model; content in parts[]

About this tool

Prompt Formatter Online is a free browser-based tool for structuring AI prompts into the correct message format for OpenAI (GPT-4o), Anthropic (Claude), and Google Gemini APIs. Build a conversation with system, user, and assistant turns, then export the exact JSON payload ready to paste into your API call or codebase.

Each provider uses a slightly different message structure. OpenAI uses a flat messages array with a role field. Anthropic separates the system prompt from the conversation turns and uses a top-level system field. Gemini uses contents with parts arrays and renames the assistant role to model. This tool handles all those differences automatically — just write your prompt and switch providers.

All formatting runs locally in your browser. Nothing is sent to any server.

Common use cases

  • Build a multi-turn prompt and export it for OpenAI, Claude, or Gemini with one click.
  • Convert a prompt from one provider format to another when switching APIs.
  • Quickly scaffold the correct JSON structure for an API call without looking up docs.
  • Test different system prompt variations by editing and re-exporting.
  • Build few-shot prompts with user/assistant example turns.
  • Format prompts for use with the Anthropic SDK, OpenAI SDK, or Google GenAI SDK.
  • Create a clean, readable plain-text version of a multi-turn conversation.
  • Share a prompt structure with teammates in a standard JSON format.

Frequently Asked Questions

What is the difference between system, user, and assistant roles?

The system message sets the AI's behavior, persona, and constraints. User messages are the human's inputs. Assistant messages are the AI's previous responses — used to provide few-shot examples or to continue an existing conversation.

How does Anthropic handle the system prompt differently?

Anthropic's API takes the system prompt as a separate top-level field (system) rather than as a message in the messages array. This tool automatically moves system messages to the correct location when exporting in Anthropic format.

Why does Gemini use "model" instead of "assistant"?

Google's Gemini API uses "model" as the role name for AI responses instead of "assistant". The formatter handles this rename automatically.

Can I have multiple system messages?

For Anthropic and Gemini, multiple system messages are concatenated into a single system field. For OpenAI, all messages including multiple system messages are included in the messages array as-is.

What is the Raw Text format?

Raw Text produces a human-readable version of the conversation with clearly labeled [SYSTEM], [USER], and [ASSISTANT] sections — useful for documentation, sharing with non-technical stakeholders, or storing prompts in plain text files.

Is my prompt content sent to a server?

No. All formatting runs locally in your browser using JavaScript. Your prompts never leave your device.

Related Tools

JSON Formatter Online

Format, validate, and minify JSON

Base64 Encoder Online

Encode and decode Base64 strings

URL Encoder Online

Encode and decode URL components

UUID Generator Online

Generate UUID v4 values in bulk

Hash Generator Online

Generate SHA-256 and SHA-512 hashes

Regex Tester Online

Test regular expressions with live match highlighting

JWT Decoder Online

Decode JWT tokens without verification

Diff Viewer Online

Compare two text blocks side by side

Timestamp Converter Online

Convert Unix timestamps to human-readable dates and back

YAML to JSON Converter Online

Convert YAML to JSON and JSON to YAML instantly

ENV File Parser Online

Parse .env files into a clean table, JSON, or export format

JSON Schema Validator Online

Validate JSON against a JSON Schema with detailed error messages

JSON Schema Generator Online

Generate JSON Schema from example JSON instantly

Token Counter Online

Count tokens for GPT-4, Claude, and Gemini models instantly

CSV to JSON Converter Online

Convert CSV data to JSON — paste, upload, or download

Number Base Converter Online

Convert numbers between binary, octal, decimal, and hexadecimal