How to add code to Google Slides

By Jake Marsh · Updated

To add code to Google Slides with syntax highlighting, open Extensions, Syntaxwell, Open code editor, paste the code, pick the language and a theme, and press Insert. The code lands on the current slide as a colored block of real text, sized to fit. Google Slides has no code block of its own, so without an add-on code goes in as a plain text box or a screenshot.

Why not a screenshot or a plain text box

MethodWhat goes wrong
Screenshot from your editorBlurry on a projector, can't be copied, has to be retaken for every fix
Plain text box in a monospace fontNo colors, and indentation shifts when the font changes
Syntaxwell blockColored text in a shape: sharp at any size, copyable, editable later

Steps

  1. Open the deck and go to the slide where the code belongs.
  2. Open Extensions, Syntaxwell, Open code editor. The sidebar opens and stays open.
  3. Paste the code. Tabs are turned into spaces and shared indentation is removed.
  4. Pick a Language (or let it auto-detect) and a Theme. Dark themes such as GitHub Dark or Dracula read well on dark decks; GitHub Light suits white slides.
  5. Pick a Font and Size. Tick Shrink to fit the slide so a long example drops its font size instead of running off the slide.
  6. Tick Line numbers if you'll refer to lines out loud, and Rounded corners if you like the look.
  7. Press Insert. Go to the next slide and insert the next block; the settings carry over.

Placing several blocks on one slide? Each new block stacks under the last one. Drag them where you want afterward.

Change code you already inserted

Click the block on the slide. The sidebar loads its code and settings. Edit the code or change the theme, then press Update block. Updating is free and doesn't count as a new block. Small typos can be fixed straight on the slide; Syntaxwell reads the text back the next time you click the block.

Turn an old text box into a block

Decks often already have code in plain text boxes. Click that text box, press Use it in the sidebar, then Convert text box. A highlighted block takes its place.

Font size for the back of the room

Code on a projector needs to be larger than it looks on your laptop. Keep examples short enough to stay at a large size, and split a long function over two slides rather than shrinking it. Shrink to fit the slide is handy for a slide you'll share, less so for one you'll present.

To walk through an example a few lines at a time, see how to highlight lines of code step by step in Google Slides.

What it costs

Syntaxwell is $2.99 a month or $19.99 a year per Google account. Free trial: 25 code blocks or 14 days, whichever comes first. No card needed. Every plan and the install link are on the Syntaxwell page.

Syntaxwell: Code Highlighting for Slides and Docs

Syntax-highlighted code blocks for Google Slides and Docs, with line numbers, highlighted lines and click-to-edit $2.99 a month or $19.99 a year per Google account.


Questions

Can people copy the code from my slides?

Yes. The block is text in a shape, so anyone with the deck can select it and paste it into an editor. In the sidebar, Copy code copies it without line numbers.

Does it work with Google Slides themes?

Yes. The block is an ordinary shape with its own fill, so it sits on any slide background.

Can I export the deck to PDF or PowerPoint?

Yes. Blocks are standard Slides shapes and text, so they come along when you download the deck in either format.

Can I make every block look the same?

Yes. The sidebar remembers your last font, theme and options as the default for the next block.


More Syntaxwell guides


More Google guides