Slack is a chat room type app designed primarily for businesses. It’s intended to work as a single centralized communications platform for the entire company where individual teams and projects can get their own communications channels. This design simplifies communication systems management when compared to managing multiple services for multiple teams across the business.
Knowing that one of the types of teams that will use Slack to communicate amongst themselves are developers, who need to share code, Slack has included a code snippet feature it calls: “Code blocks.” A code block is designed to specifically retain formatting, which can be important in the code’s actual meaning.
By default, a code block doesn’t particularly act any differently than typing normally does. While normal messages tend to be relatively short single lines of text, code is often split across multiple lines. Recognizing this fact, Slack includes an option that changes how the enter key works when you’re typing in a code block. Instead of just immediately sending the message, as is the default, the enter key starts a new line if you’re currently typing in the code block.
How to Start a New Line with the Enter Key on Slack
If you want to enable this setting, go to preferences. To do so, click on your profile picture in the top-right corner, then click on “Preferences.”

Once in preferences, switch to the “Advanced” tab. Next, tick the top setting in the “Advanced” tab, labeled “When typing code with “`, Enter should not send the message.”
With this setting enabled, the enter key will start a new line when you’re typing in a code block. To send the message, you can either press Shift + Enter from within the code block, close the code block, then move the cursor outside of the block and press enter. Or you can click the send button.
Tip: To close or open a code block, type three backticks ““`” in a row.

Configuring the enter key to start a new line in a code block makes it easier to type multiple code lines without accidentally sending the message. By following this guide, you can configure code blocks to be safer to use.
Did this help? Let us know!