Click to Skip Ad
Closing in...

How to use code blocks in Discord

computer code on screen

Why use plain text like everyone else when you can use code blocks to make your Discord messages look so much cooler? Using code blocks in Discord will give your text a different background, unique enough to make it stand out in a sea of other boring messages.

Discord has a lot of fancy text highlighting features that you can use to attract attention to whatever message you send on the app.

These texts highlighting features are options from Discord’s powerful formatting system called “Markdown.”

Markdown acts as Discord’s text formatting tool used to add aesthetics to basic texts. Some of these options include formatting the text styles, color formatting, code blocks, etc.

This guide will show you how to use code blocks in Discord and make that message pop!

Read: Our article on How to make an invisible Discord Name

What is a code block?

This image shows single line code blocks.

You might have noticed a message that grabbed your attention because of its fancy background. That’s just an added advantage of using a Code block.

A code block is a part of a text in Discord that makes your text stand out by changing its font and background. It highlights your messages or an entire message section and differentiates it from other message formats.

Code blocks are activated by using a unique key on your keyboard called the “Backtick” (`).

What is a Backtick key (`)?

The backtick key (`) is mostly found under the ESC key of your PC and is used to quote text in Discord to activate code blocks.

That said, a single backtick used as quotation marks for normal text creates a single-line code block.

Similarly, using the triple backticks to quote your plain text enables multiple line code blocks.

An Image displaying chat formatting on Discord. Single line blocks in red and multiple line code block in blue highlights.

Notice the change in font and background between the texts in this image and the plain text in the previous image. This is what code blocks in Discord do.

Additionally, Discord decided to take a step further in making formal editing to texts using codes. These extra features are the Markdown formatting features.

Don’t get confused; A code block alters the background of your text in Discord without tampering with the overall formatting. Markdown changes the text formatting.

They are both used to give your Discord messages a more catchy appearance.

Tip: Note that when using multiline code blocks, a new line may be created when you tap the enter key instead of sending the message. This effect occurs only if the cursor is inside the code block and the block has not yet been closed with the triple backticks.

Now, let’s show you how to use code blocks.

How to use code blocks in Discord for PC

The steps on how to activate a code block are the same for users with the installed Discord app or those using their web browsers.

Open Discord on your Windows PC

Open Discord on your PC

Move your cursor to the upper right below the Discord logo.

Click on “join a server” if you are not in one

A server contains different channels.

Select a channel where you are permitted to send messages.

Click the plus symbol (+) to join a server and channel, or the icon below it to join public channels of your choice

Move over to the text box and insert a backtick.

The text box enables your everyday text chat on Discord.

Type in your message

A basic discord text

Activate the block by closing the text with a single backtick

The closing quotation mark (backtick) alters the plain text font and background.

Tap the ENTER key to send the message

This is a discord message with a single line block quote.

There, you have your single-line code block!

How to use multiple-line code blocks in Discord for PC

If you wish to type more than one line and would prefer to make it stand out with the multi-line blocks, do these-

Open the Discord App on your Windows PC

Click open to launch your desktop app

Navigate to a server that permits you to send a message.

You can click "find servers" (the + icon) at the left corner.

Select a channel that permits you to send Discord text.

Click on a channel that allows text in Discord to write a code block

Head towards the text box to type your desired text.

To begin with, input three backticks.

Type three backsticks in the text box. Do not add spaces between them.

Hold down SHIFT+ENTER to begin a new line.

Press SHift and Enter at the same time to start a new line.
Hold down SHIFT and ENTR key to form a multi line block quote on a new line

Complete the multiple-line code block by adding the three backticks quotation marks.

Add three backticks for a multiline code block

Tap ENTER to send the message

This is how multiple lines of code blocks in Discord are created.

Congratulations on writing your own code block!

Tip: These steps are the exact ones for MacOS users since Discord hasn’t built a different interface.

How to write a single-line code block on iPhone

The Discord mobile app works on iOS devices just like it does on PC. You can choose to format words using code blocks from your phone.

However, because it is rarely used, you may not easily find the backtick symbol on your phone keyboard.

All you have to do is search through the keyboard carefully and memorize its location.

Once you do that, you’re good to go!

Here are some simple steps on how to use code blocks on iPhone.

Open the Discord App on your iPhone

Look for a server that permits you to send texts.

A server that permits text messages makes it easier to try your block.

Tap on a channel that permits text messaging

Click on a channel where you can type in your code block message

Tap on the text box to open the keyboard function

Tap the text box to roll out your keyboard!

Locate the backtick symbol on your keyboard and tap on it once.

Next, input your text immediately after.

You may have to search patiently for the backtick symbol on your keyboard.

Activate the same message to be a code block by adding a backtick at the end

Remember to always add your backtick at the end of your text, to activate the block

Press “Send.”

This is how your code block would look like.

How to write a multiple-line code block on iPhone

With these few steps, you should be able to write your multiple lines of code block texts in Discord:

Launch the Discord mobile app

Find or join a server

Click any Channel that permits sending texts in Discord.

Click on a channel to test your own code blocks.

Tap on the text box to open the keyboard function

Tap on the textbox to beging typing on your keyboard

Locate the backtick symbol on your keyboard and tap on it thrice.

Next, input your text immediately after the three backticks.

Every multiline code block must begin with three backsticks

Activate the same message to be a code block by adding three backticks at the end

Tap the “send” button

How to write a single-line code block on an Android

Android devices and tablets are huge supporters of the Discord app.

This means your Android and tablet devices also support code blocks! This would help you create your Discord code block as often as you wish.

Android devices also use third-party keyboard apps where you can easily find the backtick symbol.

Tip: Code blocks can also be used in direct messages on Discord. Feel free to try it out in someone’s DM and channels.

Follow the steps below to create code blocks on an Android device:

Open the Discord app on your Android device

Navigate to a server

Click the plus icon at the left corner to join one of the various servers on the app

Click on a channel that allows you to send messages

Touch the text box to bring up your keyboard

On your screen, search through the keyboard symbols and input a single backtick

Input the rest of your message and end it with another single backtick

Ending your message with a backtick activates the block.

Press the “Send” button

“here” is your single-line block!

How to write multiple-line code blocks on an Android device

Similarly, to create multiline code blocks:

Open the Discord app on your device

Look for a server

Join a text channel here. You can send Discord text formatting.

A channel is a good platform to test your blocks.

Tap on the text box to begin your multiple-line code blocks

Input three backticks

On a new line, type in your multi-line text

End your text with three backticks

Closing a text with three backticks activates the block

Press “Send.” The displayed message would have a different text formatting and background.

Syntax Highlighting language

Using code blocks in Discord is cool and makes your text formatting really catchy.

However, you can add more improvement to your code block’s appearance with the use of syntax highlighting.

Syntax Highlighting involves denoting a specific programming language right after the three backticks, at the beginning of a multiple-line code block.

It adds the specific attribute that the programming language has on Discord.

Discord’s syntax supports various programming languages, with each language having a specific syntax highlighting profile.

Your code block can look more lively with the appropriate symbols and a few characters.

Tip: The mobile app does not enable syntax highlighting

What is the difference between Markdown and Syntax language?

Markdown can be used to enable text formatting, e.g., underline text, etc., to make Discord text stand out.

Syntax language uses programming languages accepted by Discord to improve the appearance of the three backticks code block.

How to go about other Discord text formatting

One of the most basic Discord text formatting is “Style formatting.” With a bunch “f special characters, you can make your basic Discord text stand out.

To begin with, you should know that Discord allows four different text style formatting. These four styles can be used together or individually. 

They are:

 Underline formatting: To do this, add two underscore symbols to the beginning and end of your text. (__)

Underline text formatting

Strikethrough formatting: You can do this by adding two tildes (~~) at the beginning and end of your message.

Discord strikethrough text command
Strikethrough text display

Italics formatting: This is done by adding an underscore to either side of your message. It can also be done by using an asterisk on either side of your message.

Italicized text
Italicized command

Bold formatting: You can do this by adding two asterisks to the beginning and end of your message.

Bold text formatting style

Bold Italics formatting: You can combine the bold and italics style formatting by adding three asterisks to either side of your message.

Bold italicized text command
Bold italics display

FAQs

What is a code block in Discord?

Code blocks change the background and formatting style of your text in Discord.

This draws the attention of other users to the text because it stands out among other Discord texts.

How to add a code block in Discord?

Using backticks, you can add code blocks to your Discord text.

A pair of backticks on either side of a sentence highlights the sentence as a single code block.

Three backticks at the start and end of a sentence form multiple-line code blocks.

Can you run code in Discord?

Yes, you can. Discord has a high-performance bot that can execute codes from over 70 programming languages

How do you make Discord green?

This can be done in two different ways.

First, you can type in the three backticks

Next, type bash just beside the triple backticks

Then on a new line, type your text in quotation marks

And then, on another line, close the triple backticks.

For example –

“`bash
“Type your text in quotation marks to give you a dark green text.”
“`

Another way to get a dark green text display is to repeat the steps above but replace “`bash with “`” on

How do you make Discord glow Orange?

The CSS syntax, with a square bracket, gives your text highlighting an Orange display

For Example-

“`css
[Type your text to get an orange display]
“`

How do you add color to messages on Discord?

Discord has a bunch of syntax highlighting options.

We have the diff syntax highlighting, fix syntax, ini syntax, apache syntax, and so on.

These various text highlighting options are used to create the different colors of text formatting on Discord.

How do you get red text in Discord?

The diff syntax, with a dash, gives your text highlighting a red display

For Example-

“`diff
-Type your text to get a red display]

“`

Your text immediately appears red when you send the message.

What does @everyone do on Discord?

@everyone pings all users of a channel about your message, irrespective of their online or offline presence.

@here pings only those online.

Why are my Discord messages red?

This signifies that your message wasn’t sent, and the rest of the group has not seen it. You can retry your network connection settings to rectify this.

Can you get a rainbow text on Discord?

Presently, there are no methods for doing this.

However, you can use the markdown formatting on Discord to highlight and give color variations to your text.

Toby Grey contributes as a How To expert for BGR. Typing away like a keyboard super hero, he covers just about anything you can think of. If Toby isn't writing, he's probably reading a book or playing video games.