Create a snippet

Snippets are a quick, easy way to share bits of code, configuration files, or log files with your workspace.

Note: You can't currently create or share snippets in our mobile apps.

 

Add a new snippet

You can create a new snippet from the desktop app and share it in any channel or direct message:

  1. Next to the Slack message box, click the  paperclip button.
  2. Click  Create new, then select  Code or text snippet.
  3. Enter a title if you'd like and choose a file type from the menu. This can be plain text or a computer language such as HTML or Javascript.
  4. When you’re finished, click Create Snippet to post your snippet.

Keyboard shortcut: Once you start typing in the message input field, press ShiftEnter (Mac) or CtrlShiftEnter (PC) to open a pop-up window for creating a new snippet in Slack and convert your existing text.

Tip: Uploading a plain text file to Slack will automatically convert it to a snippet. Your teammates will be able to read it easily without opening a separate application. 👍🏽

 

Share a snippet

Sharing a snippet in Slack lets your members download it, view a raw version, or leave comments. You can do this when you create the snippet, or share the snippet elsewhere at any time.

For sharing options, just mouse over the snippet in your desktop app and click Share file. Next to Share in, you can choose which channel to post your snippet.


Edit a snippet

You can only edit a snippet that you have created. To find your snippets, open the   More Items menu in the top right of the desktop app and select Your Files. Find and click on your snippet, then click the  pencil icon to edit.

Note: Unlike posts, you cannot have multiple editors for one snippet.

Snippets are a quick, easy way to share bits of code, configuration files, or log files with your workspace.

Note: You can't currently create or share snippets in our mobile apps. 


Add a new snippet

Follow the steps below to create a snippet from the desktop app and share it in a channel or direct message (DM): 

  1. Click the  lightning bolt icon to the left of the message field to open the shortcuts menu.
  2. Below Slack, click Create code or text snippet
  3. Enter a title if you'd like, then choose a file type from the drop-down menu.
  4. When you're finished, click Create Snippet to post your snippet.

Tip: Start typing in the message field, then press ShiftEnter (Mac) or CtrlShiftEnter (Windows/Linux) to open a pop-up window and convert your existing text to a snippet, then continue working on it.

 

Share a snippet

Sharing a snippet in Slack lets your members download it, view a raw version, or leave comments. You can do this when you create the snippet, or any time after.

  1. Hover over a snippet, then click  Share file
  2. Below Share with, choose a channel or DM from the drop-down menu. 
  3. Click Share to post your snippet.


Edit a snippet

Find your snippets

  1. Click  Files in the left sidebar. 
  2. Select Type: in the top right to open the drop-down menu, then choose Snippets.

Note: You can only edit snippets that you have created. 

Edit your snippet

  1. Hover over the snippet you'd like to edit. 
  2. Click the  pencil icon. This will open the snippet in your browser. 
  3. Edit the snippet, then click Save Changes

Note: Unlike posts, you cannot have multiple editors for one snippet.