Code Blocks in Jira: A Step-by-Step Guide with Examples
Struggling to keep code readable in Jira? Learn how to add a code block in Jira and preserve formatting. Read now to discover the steps.
Code that loses its indentation or blends into a Jira comment can be difficult to read and even harder to troubleshoot. A command, stack trace, or configuration snippet may look fine in your editor, then become a jumble after you paste it into an issue. That makes teammates spend time guessing what the example was meant to show.
But here's the truth: Jira can display code in a dedicated block that preserves formatting and separates it from regular text. Once you know where to find the editor control, you can add readable snippets to descriptions and comments in a few steps. I’ll show you how, when to use a full block versus inline code, and how to troubleshoot common formatting problems.
How to Add a Code Block in Jira
A code block in Jira is a formatted area that displays code or technical text separately from surrounding content. It helps preserve line breaks and indentation in an issue description or comment.
Here’s the quickest way to add one. Jira’s editor can vary slightly by product version and screen, so menu labels may differ.
Open the Jira issue where you want to add the snippet. Select the description or comment field, then place your cursor where the block should appear.
Open the editor’s insert menu or formatting toolbar. Look for Code snippet, Code block, or a similar option. In some editors, typing /code opens a matching command.
Select the code-block option. Jira will add a separate formatted area to the editor.
Paste or type your code inside the block. Check that each line appears where you expect and that indentation remains clear.
If the editor offers a language selector, choose the language that best matches the snippet, such as JavaScript, Python, or JSON.
Preview the issue or comment, then save it. Confirm that the block is separate from the surrounding text and that the snippet is readable.
For example, a short command is easier to inspect when it sits on its own:
npm run test
For multiple lines, keep the complete example inside one block:
function greet(name) {
return `Hello, ${name}`;
}
The best part? You don’t need a special programming setup to make a snippet readable. The Jira editor’s formatting control handles the presentation.

When to Use a Code Block or Inline Code
Use a code block for multiple lines, commands with options, logs, or examples where indentation matters. A stack trace, for instance, is much easier to follow when every line stays grouped together.
Use inline code for a short technical term inside a sentence. If you’re telling a teammate to change timeout to 30, inline formatting keeps the sentence compact while making both values stand out.
Here's why: a large block can interrupt the flow of a short comment, while inline formatting can make a longer example hard to scan. Match the format to the amount of technical text you need to share.
For example, write, “The endpoint returns 403 when the token expires,” with inline code. Put a complete request, response, or function in a dedicated block.
Code Block Examples for Jira Issues
A useful snippet gives teammates enough context to understand what they’re seeing. Add a short label before the block, such as “Steps to reproduce,” “Expected response,” or “Relevant log lines.”
For example, a JSON response can be shown on separate lines so its structure is easy to review:
{
"status": "error",
"message": "Access denied"
}
A terminal command can include the command and its output together. That gives a reviewer a clearer picture of what happened:
$ npm run test
Tests failed: 1
Failed test: login rejects expired token
For a configuration example, include only the relevant settings. A small excerpt is easier to review than a large block of unrelated values.
retry:
attempts: 3
delay_seconds: 5
Let me explain: clear labels and focused examples help teammates connect a snippet to the issue. If a block contains sensitive credentials, remove them before posting and use a safe placeholder such as YOUR_TOKEN.
How to Keep Jira Snippets Readable
Keep each block focused on one purpose. If you’re reporting a bug, a short reproduction example usually helps more than a long section of unrelated code.
Preserve indentation when it carries meaning, especially in Python, YAML, and nested JSON. A two-space change can alter how a configuration example is interpreted.
Choose a language option when Jira provides one. Syntax coloring can help readers distinguish strings, values, and commands, although the block should remain understandable without color.
You might be wondering: should you add a screenshot instead? A screenshot can show a visual problem, but a text block is easier to copy, search, and quote in a technical discussion. For interface bugs, using both can give teammates useful context.
Troubleshooting Jira Code Formatting
The code appears as plain text. The editor may not have applied the code-block format. Edit the content, select the relevant lines, and use the formatting toolbar or insert command.
Indentation disappears. Paste the snippet into a fresh code block rather than a regular paragraph. Review the saved issue because the editor’s preview can reveal formatting differences.
The block is difficult to scan. Check for extra blank lines, unrelated examples, or missing context. Split separate examples into distinct blocks and add a short label before each one.
The language selector is missing. Some Jira editors or content fields offer fewer formatting controls. The code block can still separate the snippet from normal text; use clear labels and consistent spacing to make it readable.
ONES.com for Project and Knowledge Management
Code snippets are one part of technical collaboration. Teams also need a way to track the work connected to a bug, coordinate a release, and keep useful technical guidance accessible.

ONES.com brings project management and knowledge management together in a unified platform powered by ONES Assistant. ONES Project is the project management product and a Jira alternative; ONES Wiki is the knowledge base product and a Confluence alternative. They are sold separately, so teams can choose the capability that fits their needs.
Core Capabilities
Work gets scattered across issue tracking and planning. ONES Project provides project management capabilities in a unified platform, helping teams keep related work organized.
Teams need Jira-compatible workflows. ONES Project supports Jira-compatible workflows, which can help teams adapt established work patterns.
Standard fields don’t capture every team’s process. Custom workflows and fields let teams shape how work is recorded and moved through review.
Sprint planning needs a clear home. Sprint management supports planning and tracking work across an iteration.
Repeated manual steps take time. Automation can handle routine workflow actions, leaving people more time for review and problem-solving.
Progress is hard to see at a glance. Built-in reporting helps teams review work and monitor project progress.
Technical guidance is difficult to find. ONES Wiki gives teams a knowledge management space for organizing and sharing useful guidance.
Teams have deployment requirements. ONES.com offers Cloud, On-Premise, Private Cloud, and Air-gapped deployments, with feature parity between cloud and self-hosted versions.
Application Scenarios
A software team could track a bug in ONES Project, use a custom workflow for investigation and review, and monitor sprint progress with built-in reporting. A concise Jira issue snippet can remain part of the technical discussion, while the related project work has a clear place to move forward.
A team with specialized deployment requirements could evaluate an On-Premise, Private Cloud, or Air-gapped deployment. If it also needs a shared home for troubleshooting guidance, it could consider ONES Wiki separately from ONES Project.
Common Challenges When Sharing Code in Jira
Challenge: Teammates can’t tell what the snippet demonstrates. Solution: Add a brief explanation before the block, such as “This response appears after an expired session.”
Challenge: One block contains several unrelated examples. Solution: Separate commands, logs, and configuration excerpts into individual blocks with clear labels.
Challenge: A snippet exposes a credential. Solution: Replace private values with safe placeholders before posting. Check each line, including logs and command arguments.
Challenge: Formatting changes after saving. Solution: Preview the issue or comment after editing. If the result still looks wrong, recreate the block with the editor’s formatting control.
FAQs About Code Blocks in Jira
Can I add a code block to a Jira comment?
In many Jira editors, you can add a code block in a comment using the formatting toolbar, insert menu, or a slash command such as /code. Available controls can vary by Jira version and the field you’re editing. If the option isn’t visible, check the editor’s insert menu or try a supported command. Preview the comment before submitting it to confirm the formatting appears as intended.
What’s the difference between inline code and a code block?
Inline code formats a short technical term within a sentence, such as statusCode or 404. A code block places a longer example on separate lines and helps preserve its structure. Use inline formatting for a variable or value you mention in passing. Choose a block for commands, logs, configuration examples, or code with indentation.
Why doesn’t Jira format my pasted snippet?
The text may have been pasted into a regular paragraph instead of a code block. Select the code-block control before pasting, or use the editor’s formatting menu to convert the relevant text. Some Jira editors provide different controls, so check the menu available in your issue field. Previewing the saved content helps you spot missing line breaks or indentation before teammates rely on the example.
Can I choose a programming language for a Jira code block?
Some Jira editors provide a language selector when you insert a code block. If you see one, choose the language that matches your snippet to enable more helpful syntax coloring. The option may not appear in every Jira field or editor version. A language label can improve scanning, but a short description and clean formatting still help when coloring is unavailable.
Conclusion
A well-formatted code block makes technical details easier to read, discuss, and act on. Open the issue’s description or comment field, insert a code block, add a focused example, and preview it before saving.
When formatting gets in the way, use inline code for short terms and reserve blocks for multi-line examples. A clear label, preserved indentation, and careful removal of credentials can make a Jira discussion much more useful.