How to Add a Code Block in Jira
- Sophie Ricci
- Views : 28,543
Table of Contents
If you’ve ever pasted raw code into a Jira comment and watched it turn into an unreadable wall of text — you already know the problem.
Code blocks exist for one reason: to make technical information readable. And in a project management tool where engineers, product managers, and stakeholders all collaborate in the same space, that matters more than most people realize.
This guide walks you through exactly how to add code blocks in Jira — across different views, editors, and use cases — so your technical communication is always clean and precise.
Why Code Blocks Matter in Jira
Jira is used by over 65,000 companies worldwide, ranging from two-person startups to Fortune 500 engineering teams. And with software teams spending an average of 31% of their time on communication and documentation, the way you format technical content inside Jira directly impacts how fast bugs get resolved, how clearly requirements are understood, and how much time gets wasted re-explaining things.
Unformatted code in comments leads to misinterpretation. Formatted code blocks:
- Preserve spacing and indentation
- Enable syntax differentiation
- Make copy-pasting reliable
- Signal professionalism and clarity
The difference between a wall of text and a clean code block can be the difference between a ticket getting resolved in two hours versus two days.
Understanding Jira’s Two Editor Types
Before diving into steps, you need to know which editor you’re working with — because the method differs.
New Jira Experience (Next-Gen / Jira Cloud): Uses a rich-text editor with toolbar options. This is what most teams on Jira Cloud use today.
Classic Jira (with Wiki Markup): Uses text-based formatting with curly brace macros. Common in older Jira instances, Jira Server, and Jira Data Center.
Knowing which version you’re on saves you significant frustration. If you see a formatting toolbar at the top of your comment box, you’re in the rich-text editor. If you see a plain text area with a “Wiki Markup” or “Text” mode toggle, you’re in the classic experience.
How to Add a Code Block in the New Jira Editor (Rich Text)
This is the most common scenario for teams on Jira Cloud.
Using the Toolbar
Open any Jira issue and click into the comment or description field. You’ll see a formatting toolbar appear at the top of the text area.
Look for the { } icon — this is the inline code button. Click the dropdown arrow next to it (if available) and select Code Block from the options. A code block will appear in your editor where you can type or paste your code.
Using the Slash Command
Click anywhere in the text editor and type / — a command menu will pop up. Start typing code and you’ll see Code Block appear as an option. Select it and a formatted block is inserted instantly.
This is the fastest method once you get used to it.
Using the Keyboard Shortcut
If you prefer keeping your hands on the keyboard:
- Highlight the text you want to format as code
- Use ` (backtick) on either side for inline code
- For a full code block, use triple backticks “` before and after the block
How to Add a Code Block in Classic Jira (Wiki Markup)
If you’re working in Jira Server, Jira Data Center, or an older Jira Cloud instance still running classic editor, use the following wiki markup syntax.
Basic Code Block
{code}
your code here
{code}
This creates a plain code block with no language-specific formatting.
Code Block With Syntax Highlighting
To trigger syntax highlighting for a specific programming language:
{code:language=java}
public class HelloWorld {
public static void main(String[] args) {
System.out.println(“Hello, World!”);
}
}
{code}
Supported language values include: java, javascript, python, sql, xml, html, css, bash, ruby, csharp, php, and more.
Code Block With a Title
{code:title=Example Function|language=python}
def greet(name):
return f”Hello, {name}”
{code}
Adding a title makes it immediately clear what the block contains — especially useful in long tickets with multiple code samples.
How to Add Inline Code in Jira
Not every piece of code needs a full block. Sometimes you just need to reference a variable name, a function, or a command inline within a sentence.
In the Rich Text Editor: Highlight the word or phrase and click the { } inline code button in the toolbar, or wrap it with a single backtick `.
In Wiki Markup: Use double curly braces: {{your_variable_name}}
This keeps your comments readable without breaking the flow of your explanation.
How to Add a Code Block in Jira Comments vs. Descriptions
The good news: the method is identical whether you’re formatting a comment or an issue description. Both fields use the same editor, and both support the same formatting macros.
The only thing to watch: description fields sometimes default to a simplified editor on mobile. If you’re on the Jira mobile app, consider switching to desktop view for complex formatting.
How to Add a Code Block in Confluence (Connected to Jira)
Many teams link Jira with Confluence for documentation. If you’re embedding code in a Confluence page connected to Jira:
- In the Confluence editor, type / and search for Code Block
- Select the language from the dropdown (over 40 supported)
- Choose display options: show line numbers, enable collapsing, set a title
Confluence’s code block macro is more fully featured than Jira’s — especially useful for longer, standalone documentation that engineers reference repeatedly.
According to Atlassian’s own data, teams that integrate Jira with Confluence see a 26% improvement in project visibility — and clear code documentation is a major contributor to that.
Pro Tips for Formatting Code in Jira
These small habits separate well-run technical teams from chaotic ones.
Always specify the language. Even if syntax highlighting isn’t critical, labeling the language (language=python) tells anyone reading the ticket exactly what they’re looking at before they start parsing the code.
Use titles on every code block in long tickets. If a ticket has three code blocks, unnamed blocks force readers to scan each one to understand context. A title like “Before Fix” and “After Fix” removes that friction entirely.
Keep code blocks focused. Paste only the relevant lines — not 200 lines of file output. A focused 10-line code block gets read. A 200-line dump gets skipped.
Pair code blocks with plain-language explanations. Studies show that technical content paired with structured explanation is retained 40% more effectively than standalone code. A two-sentence summary above your code block dramatically increases how fast someone else can act on it.
Test your formatting before saving. Jira’s preview mode (available in most editors) shows you exactly how the block will render. Use it. A misplaced backtick can break your entire block.
Common Issues and How to Fix Them
Code block not rendering correctly
If your wiki markup isn’t rendering, check for a stray space before the opening {code} tag. Wiki markup is sensitive to spacing. Make sure the tag starts at the beginning of the line.
Syntax highlighting not working
Ensure you’re specifying a supported language value. language=Javascript (capital J) may not work — use language=javascript in lowercase.
Toolbar not showing formatting options
Some project types in Jira (particularly simplified Next-Gen projects) may have a reduced toolbar. Try switching to the full editor view using the expand icon in the text area.
Code block appearing as plain text in emails
When Jira sends email notifications, code blocks are often stripped of formatting. This is a known limitation. For recipients who need clean code, link them directly to the Jira issue rather than relying on the email notification.
How Different Teams Use Code Blocks in Jira
Understanding real use cases makes the format click faster.
Engineering teams use code blocks to attach stack traces, reproduction steps with commands, and database queries directly to bug tickets — reducing back-and-forth by an average of 30% according to developer productivity research.
QA teams attach test scripts and automation code to test cases, keeping executable logic connected to the test evidence.
DevOps teams embed configuration snippets, deployment commands, and environment variables directly into Jira tasks — eliminating the “where’s that config?” message thread.
Product teams use inline code formatting to reference specific API parameters or field names when writing technical requirements — cutting developer misinterpretation significantly.
Jira Code Block vs. Attachment: Which Should You Use?
A question that comes up often: should you paste code inline or attach a file?
Use a code block when:
- The code snippet is under ~50 lines
- You want the content searchable within Jira
- You want reviewers to read without downloading anything
- You’re highlighting a specific section for discussion
Use an attachment when:
- The code is a full file or module (100+ lines)
- You need version-specific files saved to the ticket
- You’re attaching logs or output files for reference
In general, code blocks win for communication. Attachments win for archiving. Use both when the situation calls for it.
🚀 Stop Cold Outreach the Hard Way
We run done-for-you LinkedIn & email campaigns that consistently book 15–25% response rates.
7-day Free Trial |No Credit Card Needed.
FAQs
How do I add code blocks in Jira if my team relies on reaching prospects the same way — pasting raw messages that get ignored?
Can I add a code block in Jira on mobile?
Does Jira support syntax highlighting in code blocks?
Can I collapse long code blocks in Jira?
What's the character limit for Jira comments?
We deliver 100–400+ qualified appointments in a year through tailored omnichannel strategies
- blog
- Sales Development
- How to Add a Code Block in Jira