Learn how to write inline code and fenced code blocks in markdown with syntax highlighting. Examples, platform support, and tips.
Markdown supports two types of code formatting: inline code with single backticks (`) for short snippets, and fenced code blocks with triple backticks (```) for multi-line code with optional syntax highlighting.
Single backticks for inline code within a sentence.
console.log() functionTriple backticks for multi-line code blocks.
const x = 42
console.log(x)Add a language identifier after the opening backticks for colored syntax highlighting.
const greeting = "hello"
console.log(greeting)| Platform | Supported | Notes |
|---|---|---|
| GitHub | Yes | Full syntax highlighting for 200+ languages |
| GitLab | Yes | Full syntax highlighting |
| Discord | Yes | Syntax highlighting for common languages |
| Slack | Partial | Inline code and blocks, no syntax highlighting |
| Yes | Indent with 4 spaces or use fenced blocks | |
| Stack Overflow | Yes | — |
| Notion | Yes | Full syntax highlighting |
| Obsidian | Yes | — |
``code``
`code`
Use single backticks for inline code. Double backticks are only needed when the code itself contains a backtick.
``` code```
``` code ```
The closing ``` must be on its own line. Putting it on the same line as code will break the block.
```js code here```
```js code here ```
Code must start on the line after the opening backticks. The language identifier goes right after ``` with no space.
Adding a language (```python, ```sql, etc.) enables syntax highlighting and helps readers identify the language at a glance.
```python
def hello():
print("hi")
```To include a literal backtick in inline code, use double backticks: ``code with ` backtick``.
``code with ` backtick``
You can also create code blocks by indenting every line with 4 spaces. But fenced blocks (```) are clearer and support language hints.
Everything you need to know.
Wrap your code with triple backticks (```) on separate lines. For inline code, use single backticks: `code`.
Bold text in markdown is created by wrapping words with double asterisks (**) or double underscores (__). Bold draws attention to important words and phrases, making your content easier to scan.
Blockquotes in markdown start with a greater-than sign (>) followed by a space. They render as indented, visually distinct blocks — perfect for quoting text, highlighting notes, or calling out important information.
Markdown tables use pipes (|) and hyphens (-) to create rows and columns. The second row defines column alignment with colons. Tables are ideal for structured data, comparisons, and reference material.
Paste your markdown and see code block rendered instantly with professional themes.