Create or paste code snippets in Slack

Who can use this feature?
  • All members and guests
  • Available on all plans

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

Note: You can't currently create or share snippets from the Slack mobile apps. 


Add a new snippet

Follow the steps below to create a snippet and share it in a conversation if you'd like: 

  1. From your desktop, click the  lightning bolt icon to the left of the message field to open the shortcuts menu.
  2. Select  Create a text snippet from the menu. 
  3. Enter a title if you'd like, then choose a file type from the drop-down menu.
  4. Type or paste your snippet in the Content field.
  5. To share your snippet, check the box next to Share this file, select a conversation, and add a message if you’d like.
  6. Click Create Snippet.

Tip: If you've already started typing, you can press ShiftEnter (Mac) or CtrlShiftEnter (Windows/Linux) to open a pop-up window and convert your existing text to a snippet. 


View snippets in your workspace

Use the File browser to view all of the snippets in your workspace.

  1. Click  File browser in the left sidebar. If you don't see this option, click  More to find it.
  2. Select  Filter in the top-right corner of the screen.
  3. Click All file types to open the drop-down menu, then select Snippets.


Edit a snippet

You can edit any snippets that you've created. Only the person who created a snippet can edit it.

  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


Share a snippet

Sharing a snippet in Slack lets others 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 direct message (DM) from the drop-down menu. 
  3. Click Share.