Improvements to Code Blocks in Microsoft Teams

Microsoft is improving how code blocks work when composing messages in Teams, making it easier for users to read, share, and reference code in their chats and channels. These changes are aimed at anyone who works with code in Teams and bring the experience closer to other tools commonly used by developers and engineers.

Here is a sample of the previous code block integration.

The previous code block integration
The previous code block integration

Users will notice four improvements to code blocks in Teams messages. These improvements are automatically enabled in existing code blocks.

  • When a user inserts a code block, line numbers are now automatically visible. This makes it easier to point to a specific line when collaborating on or reviewing code.
Line numbers are now automatically visible
Line numbers are now automatically visible
  • Keyboard navigation within code blocks has been improved, allowing users to move through their code more easily with keyboard commands. This is helpful for everyone, and particularly for those who rely on a keyboard rather than a mouse.
  • Teams now remembers the last programming language a user selected for syntax highlighting, so the language no longer needs to be set again each time a code block is added.
Remembering the previously selected programming language
Remembering the previously selected programming language
  • For situations where people want to work on code together, a code block can be converted into a Loop component before it is sent, allowing others to edit it collaboratively. This option requires Loop components in Teams.
Convert a code block into a Loop component
Convert a code block into a Loop component

The familiar ways of inserting a code block remain available, including slash commands, keyboard shortcuts, and Markdown, so users can continue working in their preferred way.
This update applies to Teams on Windows, Mac, and the web, and is available to all Teams users. The rollout should be completed in May 2026.

Share
Avatar photo

Tobias Asböck

Tobias is a Senior System Engineer with more than 10 years of professional experience with Microsoft 365 products such as SharePoint Online, SharePoint Premium, OneDrive for Business, Teams Collaboration, Entra ID, Information Protection, Universal Print, and Microsoft 365 Licensing. He also has 15+ years of experience planning, administering, and operating SharePoint Server environments. Tobias is a PowerShell Scripter with certifications for Microsoft 365 products. In his spare time, Tobias is busy with updates in the Microsoft 365 world or on the road with his road bike and other sports activities. If you have additional questions, please contact me via LinkedIn or [email protected].

Leave a Reply

Your email address will not be published. Required fields are marked *