Diwali sale. Pro for $10 instead of $18 with code DIWALI26 at checkout, until November 15.
Free · Live examples · No sign-up

Markdown code blocks and inline code

Wrap a word in single backticks for inline code, or put three backticks on the lines above and below a block. Add a language name after the opening three for highlighting. Every example below is live.

Free in your browser. On a Mac, TypeFire opens every .md file like this, right from Finder.Download free for Mac

Setup notes.md
FileEditViewInsertFormatHelp
Setup notes.md

Setup notes

Inline code

Run npm install first, then open config.json.

A fenced code block

npm install
npm run dev

With a language name

def greet(name):
    return f"Hello, {name}!"

Showing a diff

- timeout = 30
+ timeout = 60
Loading the editor…Your files stay in your browser
  • Your files never leave your browser
  • Free, no sign-up
  • Download as Markdown, Word, a web page or a PDF

This editor comes from TypeFire, free for Mac

Your whole folder of Markdown notes in tabs, Quick Look previews in Finder, plus a text expander and a clipboard manager.

How it works

Write code in Markdown

  1. 01

    Inline code

    Wrap it in single backticks: `npm install`. Use it for a command, a file name or a value inside a sentence.

  2. 02

    A fenced block

    Put ``` on a line by itself, the code under it, and ``` again to close it. Spacing and line breaks stay exactly as typed.

  3. 03

    Name the language

    Write the language right after the opening backticks, like ```python or ```bash, so the renderer can color the code.

Inline code in backticks and a fenced bash code block shown as formatted code
Free for Mac and Chrome

Like this editor? Get TypeFire.

The same editor on your whole folder of Markdown notes, plus a text expander and a clipboard manager. On a Mac, every .md file previews in Finder when you press Space.

Download free for MacAdd to Chrome7 day Pro trial, no card required.

Free text expander, markdown notes and a clipboard manager. $18 once for unlimited clips, notes sync and AI prompts.

A README.md previewed in Finder with Quick Look on a Mac, after pressing Space
At a glance

Language names people use most

Write these right after the opening backticks. The same names work on GitHub, GitLab and most renderers.

Terminal commands
Name after ```:bash or sh
Good for:Install steps, scripts
Python
Name after ```:python
Good for:Snippets and examples
JavaScript
Name after ```:js or javascript
Good for:Web code
JSON
Name after ```:json
Good for:Config files and API responses
A change between versions
Name after ```:diff
Good for:Lines starting with + or - shown as added or removed
What it does

Small things that trip people up

Code blocks are simple until a backtick appears inside one.

Download a document as Markdown, a web page or a PDF from the File menu
  1. Backticks inside inline code

    Use two backticks around it, with a space: `` `like this` `` shows the backticks.

  2. Three backticks inside a block

    Open and close the block with four backticks instead, and the three inside stay as text.

  3. Tildes work too

    ~~~ opens and closes a block the same way as ```, handy when the code is full of backticks.

  4. Four spaces is the old way

    Indenting every line four spaces also makes a code block, but it can't name a language, so fences are better.

Take it further

The same editor, without the browser tab

This editor comes from TypeFire, a free app for Markdown notes, a text expander and a clipboard manager. Here it works on the files you open. In the app, it opens your whole folder.

TypeFire for Mac with several Markdown notes open in one tab bar

TypeFire for Mac

  • Press Space on any .md file in Finder and read it rendered, with Quick Look.
  • Open a folder of Markdown, an Obsidian vault included, with tabs, search and links.
  • A text expander and a clipboard history in the same free app.
In a browser email, typing thx and a space expands into a whole thank-you reply

TypeFire for Chrome

  • This editor in its own tab, one click from the toolbar.
  • Your folder of .md notes in tabs, with search and links.
  • A text expander and your clipboard history on every site.

Frequently asked questions

Still not answered?

Put three backticks (```) on a line by itself, the code underneath, then three backticks again to close it.

Wrap the text in single backticks, like `this`.

It shows in a monospace font inside the sentence.

Write the language name right after the opening backticks, for example ```python.

The renderer colors the code if it knows the language.

Open and close the block with four backticks, or with ~~~, and three backticks inside stay as text.

Both make a code block. A fenced block with ``` can name its language and is easier to read, so it's the one to use.

Write Markdown without looking it up

TypeFire's editor formats as you type, code blocks included, on the Mac and in your browser. Free.

Download free for MacAdd to ChromeSee what $18 adds7 day Pro trial, no card required.

Free text expander, markdown notes and a clipboard manager. $18 once for unlimited clips, notes sync and AI prompts.

your clips your snippets