Today, Mytour will guide you on how to create a code line or code block in your Discord conversations. This process works seamlessly on both desktop and mobile versions of Discord.
Steps
On Desktop

Launch Discord. Click or double-click the Discord app featuring a white icon on a purple background. The Discord chat window will open if you're already logged in.
- If you're not logged in, enter your email address and password, then click Login.

Select a channel. Click on the channel where you want to send your text, located at the top-left corner of the page.

Click on the message box at the bottom of the Discord window.

Press the back-tick key. This key, which looks like a grave accent `, is usually found at the top-left of the keyboard, sharing the same key as the tilde (~). A grave accent will appear in the Discord text box.
- If you want to format a code block, skip this step and the next three steps.

Enter the text you want to format. Type the word or phrase you wish to format as a code line.

Press the back-tick key again. Now, you will have two grave accents at the beginning and end of the text you are sending as code.
- For example, to format the line "I like trains," you would type `I like trains` into the text box.


Format a code block. If you want to send a code snippet (e.g., an HTML page) to someone via Discord, you can type three back-ticks (```) before and after the text, then press ↵ Enter.
- For example, to format the code "<!DOCTYPE html>" as a block, type ```<!DOCTYPE html>``` into Discord and press ↵ Enter.
- If you want to specify a language for the code block, type three back-ticks, enter the language (e.g., ) on the first line, create a new line, and add the rest of the code before closing with three back-ticks.
On Mobile

Open Discord. Tap on the Discord app with the white icon on a purple background. The Discord chat window will open if you're already logged in.

Select a channel. Tap on the channel where you want to send your text.

Tap on the text box at the bottom of the screen.

Enter the back-tick character. The back-tick can be entered in various ways depending on your phone type:
- On iPhone — Tap the 123 button at the bottom-left of the keyboard, hold the apostrophe symbol below the back button, slide your finger left to select the back-tick symbol (`), then release.
- On Android — Press the !#1 button at the bottom-left of the keyboard, then tap the ` symbol.
- If you want to format a code block, skip this step and the next three steps.

Enter your code. Type the text you want to format.

Add another back-tick. Another back-tick will appear on the other side of the text.
- For example, to format the phrase "Hello there!", type `Hello there!` into the chat box.



Format a code block. If you want to send a code snippet (e.g., an HTML page) to someone via Discord, you can type three back-ticks (```) before and after the text, then tap the "Send" icon.
- For example, to format the code "<!DOCTYPE html>" as a block, type ```<!DOCTYPE html>``` into Discord.
- If you want to specify a language for the code block, type three back-ticks, enter the language (e.g., ) on the first line, create a new line, and add the rest of the code before closing with three back-ticks.
Tips
- Discord supports multiple languages, which you can activate by entering one of the following codes right after the three back-ticks when formatting a code block:
- markdown
- ruby
- php
- perl
- python
- javascript
- java
- cpp (C++)
- Formatting code blocks is highly useful and can be applied in various scenarios, from drawing attention to a piece of text (e.g., a poem) to sending code snippets while preserving their formatting.
Warnings
- If you're using a non-standard Android keyboard layout, you might need to hold the apostrophe key or navigate through different pages to find the back-tick symbol.