Send code snippets in a message in Teams

Send code snippets in a message in Teams

To send a code snippet in a chat or channel message, first click Format Expand button below the compose box, then select Code snippet Code snippet button in the format bar. This opens a dialog box, where you can enter your code as well as a title for the snippet. Select the language you want to use, and choose whether you want your text to wrap.

Syntax highlighting and auto-indentation help you to write your code the way you want. When you send your snippet, it’s included in the message as a card, and the recipient can view it inline with the syntax highlighting intact.

If you want to edit your code snippet after you’ve sent it, select More options More options button > Edit on your message, then Edit Edit button again on the snippet card.

Need more help?

Expand your Office skills
Explore training
Get new features first
Join Office Insiders

Was this information helpful?

Thank you for your feedback!

Thank you for your feedback! It sounds like it might be helpful to connect you to one of our Office support agents.