To stop chatgpt from using code blocks, you must explicitly define your output format and avoid terms like template or syntax that trigger technical formatting. The easiest fix is to tell the AI to use standard markdown paragraphs instead of a code container. This forces the model to present your text as normal, readable paragraphs.
It is incredibly annoying when you ask for a simple email draft or blog post, only to have the AI wrap the entire response in a grey, monospaced code window. You have to click extra buttons to copy it, and the formatting often breaks when you paste it into your editor.
Why you need to stop chatgpt from using code blocks
You need to stop this behavior because text trapped in code blocks is difficult to edit and loses its natural formatting when pasted. It also signals that the AI did not understand the creative context of your request, treating your text as computer code rather than human communication.
When text is placed in these grey boxes, it is usually styled in a monospaced font. Line breaks are often hard-coded, meaning the text will not wrap naturally when you resize your window or paste it into an email. This creates extra work for you. Instead of a quick copy and paste, you have to manually reformat the paragraphs, fix the line breaks, and change the fonts. Taking control of this formatting saves you hours of clean-up work over the course of a week.
What causes the AI to use code boxes for text?
The main cause of this problem is ambiguous phrasing in your prompt that triggers the AI to think you want a technical output. Words like "raw text," "template," "script," or "exact format" often signal to the model that it should present the text in a code block.
AI models are trained on massive datasets of programming code and technical documentation. In those datasets, templates and technical scripts are almost always wrapped in code blocks. When you use these trigger words, the AI tries to be helpful by using those same blocks. It does not realize you just want a standard document. Another common cause is asking the AI to preserve HTML tags or specific symbols. The model defaults to a code block to ensure those symbols display correctly without breaking your web browser.
How to write a prompt that keeps text in standard paragraphs
To keep your text in standard paragraphs, you must explicitly state the desired format and use direct negative constraints. Tell the AI to output standard text and forbid the use of markdown code boxes.
You can achieve this by giving the AI a clear role and a specific output format. Avoid vague instructions. Instead of saying "give me a template," say "write this as a standard email." If the AI still struggles, you can add a strict rule at the end of your prompt.
If you are tired of guessing which words trigger these annoying formatting bugs, you can use tools to design your instructions. For example, The Prompt Engineer asks you simple questions about your goals and automatically builds a clean, structured prompt that prevents formatting issues altogether.
Let us look at a common example of a weak prompt and how a few simple changes can fix the output.
Weak prompt
Write a template for a client onboarding email. Keep it clean and put it in a copy-paste format.
Stronger prompt
Act as a professional client relations manager. Write a standard email welcoming a new client.
Formatting rules:
- Output the text as standard body paragraphs.
- Do not use markdown code blocks, grey boxes, or monospaced code windows.
- Use normal line breaks and standard spacing.
"The secret to perfect AI formatting is to describe what the output is, rather than how it should be packaged."
How to fix an existing response that is stuck in a code block
To fix an existing response that is stuck in a code block, you can use a quick follow-up prompt that tells the AI to reformat the previous turn. Simply instruct the model to rewrite the text as standard body paragraphs without changing any of the words.
You do not have to start a brand new conversation if the AI gets it wrong the first time. A simple correction prompt can pull your text out of the box instantly. For example, you can reply with: "Please rewrite your last response, but output it as standard text instead of putting it in a code block." The AI will recognize its formatting error and reprint the text in a clean, copy-pasteable format.
Checklist for clean text formatting
This simple checklist will help you audit your prompts before you hit submit to ensure clean formatting. By scanning your prompt for technical keywords and adding explicit constraints, you can prevent code blocks from appearing.
Review these points whenever you write a new prompt:
- Avoid technical keywords: Remove words like "raw," "template," "script," "preformatted," or "code."
- Specify the destination: Tell the AI where the text is going, such as "an email editor" or "a Google Doc."
- Use negative constraints: Explicitly state: "Do not wrap this text in a code block or markdown container."
- Request standard markdown: Ask for standard headings and paragraphs instead of code blocks.
Common questions
Why does ChatGPT put HTML in code blocks?
ChatGPT puts HTML in code blocks because it recognizes HTML as programming syntax. The model defaults to using code blocks to prevent your web browser from executing the code, allowing you to see and copy the actual tags. To stop this, ask the AI to write the text without using any HTML tags.
Can I change the default settings to stop code blocks?
You cannot change the default settings of the AI model to stop code blocks globally. However, you can use custom instructions or system prompts to tell the AI to never use code blocks in its replies. This applies the rule to every conversation you start.
Does this issue happen in other AI tools?
Yes, this formatting issue happens in all major AI models, including Claude and Gemini. They all use similar training data that associates technical layouts with code blocks. Using the same negative constraints will fix the issue across all of these platforms.
The short version
- Code blocks appear because the AI misinterprets vague words like "template" or "raw" as technical requests.
- You can stop this behavior by explicitly commanding the AI to use standard paragraphs and standard markdown.
- Always include a negative constraint like "Do not use code boxes or monospaced fonts."
- Specifying the end platform, like a Google Doc or an email client, helps the AI choose the right format.
Related reading
- How to Stop ChatGPT From Adding Annoying Disclaimers: Tired of the preachiness? Here is how to write prompts that get straight to the point without warning labels.
- How to Stop ChatGPT From Being So Wordy: Learn how to eliminate fluff and get direct, concise answers from your AI prompts.
- How to Stop ChatGPT From Constantly Apologizing: Tired of your AI saying sorry instead of fixing your work? Here is how to write prompts that skip the fluff.
- How to Stop ChatGPT From Repeating the Same Words: If your AI assistant sounds like a broken record, the fix is in your instructions, not the model. Here is how to write prompts that force variety.
- How to Stop ChatGPT From Giving You the Same Generic Advice: Tired of the same basic bullet points? Here is how to fix your prompts and get unique, actionable advice from AI.
