Code blocks & inline code

Medium supports code blocks and inline code tags.

Code block


To begin a code block, on a new line type in ``` (triple backtick).

c03E9Iqvtx.gif

Keyboard shortcut: ⌘ + Opt + 6 / Ctrl + Alt + 6.

Inline code


For inline code in a paragraph, type a single backtick ` to begin and end your code. Or highlight some text and press the backtick key.

1_kM1zwgKfielgcShOed6sGQ.gif

Note: Code blocks and inline code are not supported on mobile.

Syntax highlighting


Medium code blocks do not support syntax highlighting. To embed code with syntax highlighting on Medium, try Github Gists, Codepen.io, or JSfiddle. Paste your snippet URL from one of those sources to a new line in the editor and press Enter. Learn more about embeds.

Was this article helpful?
Have more questions? Submit a request