How to add code blocks in Notion

How to add code blocks in Notion

Notion is a lot of people's favourite no-code tool... Though, if you have to deal with code, Notion lets you share that!

There is a block that's specifically made for coding, and you can always add it in your Notion page. Let's see how to do that!

Why add code blocks in Notion?

Code blocks are awesome because they have a unique look within Notion, the no-code app. That's just the aesthetics, right?

On top of that, the code block allows you to drop your favourite lines of code in multiple coding languages, and they can be copied on the spot, upon clicking a single button.

That's sharing code smartly!

How to make code blocks in Notion

1. Type "/code"

The very first step is building the code block. To do that, you can either type "/code" or just type "/" and scroll all the way down to "Code".

How to build code blocks in Notion

2. Select the code's language

As soon as you made the "Code" block, you have many other languages to choose from.

For this example, we chose to paste some "JavaScript" code.

In the top-left corner of the block, you can see the "JavaScript" text (or whatever else language that's showing there, in your case).

Upon clicking there, you get this long dropdown with many other languages that you can choose from.

At the same time, there's also the "Search" function, if that's easier for you rather than scrolling all the way down to your preferred language.

How to add code blokcs in Notion

You can also change the language if you click on the coding block's three dot icon in the top right corner of the block, and then hitting the "Select language" button.

Then, the process is the same - you either search or scroll until you find your preferred coding language.

One other way to change the coding language is clicking on the block's settings, on the icon with the six dots (to the left outside of the block).

Then, the process is yet again the same one.

Hey, got any coding subpages that you wan to be linked to your main page? Have a look at our guide on how to link subpages in Notion.

3. Copy the code

This step is just optional. Both from the editable and the public (sharable) sides of your page, you can copy the code with just one button that's always in the top-right corner - the "Copy" button.

Notion how to use code blocks

Can you add code blocks in Notion?

Yes, Notion has the function which allows you to add code blocks, and it's really easy to use.

If this guide was helpful, make sure to check our library of Notion guides. There you can find lots of other guides on how to efficiently use Notion.

Got any other question?
Need help with anything else? Use the live chat button in the lower right corner → we'll do our best to clarify things for you!

P.S: Have you seen our Notion Forms feature?
Back to all the guides