AI Logo
AI Exporter Hub
Tips & Tricks

Specifying the desired format

J
Jack
June 19, 2025
prompts
Specifying the desired format

Specifying the desired format

One of the simplest ways to control Claude’s output is to simply state the format you want. Claude can understand and follow instructions related to formatting, and format outputs such as:

  • JSON
  • XML
  • HTML
  • Markdown
  • CSV
  • Custom formats For example, if you want Claude to generate a haiku in JSON format, you can use a prompt like this:

Prefilling Claude’s response

Another effective way to control Claude’s output format is to prefill the Assistant field with the beginning of the desired format. This technique is particularly useful when working with structured formats like JSON or HTML.

For example, to generate a recipe in JSON format:

By prefilling the response with the opening JSON curly brace, you give Claude a clear starting point for generating the recipe in the desired format. This also is another technique you can use to have Claude skip its friendly preamble text.

Providing examples

In addition to explicit instructions, providing examples of the desired output format can help Claude better understand your requirements. When including examples, make it clear that Claude should follow the formatting of the examples provided (otherwise Claude may pick up other details from the provided examples, such as content or writing style).

Here is an example prompt showcasing this technique:

Tips for better output control

  • Be as specific as possible in your instructions
  • Use clear and consistent formatting in your prompts
  • Provide multiple examples when possible to reinforce the desired format
  • Experiment with different combinations of techniques to find what works best for your use case

Want to read more?

Explore our collection of guides and tutorials.

View All Articles