productivity

April 15, 2024

How to Use Code Blocks in Google Docs

Jess Cooper

Jess Cooper

Learn how software developers can download the code block extension and create a code block in Google Docs

How to Use Code Blocks in Google Docs

Software developers and engineers need easy-to-use tools to keep their notes and projects organized. Many companies opt for platforms like Google Docs. While Google Docs is powerful, it isn't necessarily built with software developers' or development teams' needs in mind.


Regardless, with a few clicks, you can still improve the setup to work better for you. In this post, we'll show you how to create a code block in Google Docs.


And if you're looking for a better docs option built specifically for developers, feel free to skip to the end!

Why use code blocks in Google Docs?

There are several instances why you might want to use code blocks in Google Docs.

  1. If you're creating technical documentation with how-tos that include things like commands or queries to run, leveraging code blocks will make it easier for whoever is using the documentation. Code blocks are the best way to insert these types of things inline.
  2. If you're creating an implementation plan in Google Docs, you might want to include small lines of code that relate to what you'll implement. Code blocks are the best way to add small chunks of code to Docs.
  3. If you need to keep a running list of code snippets or commands that your team uses, like for deploying or running a test suite. If Google Docs doesn't work for you, you could also explore GitHub Gists.

Code blocks also offer additional benefits, like making code snippets easier to read with syntax highlighting.

Adding code blocks can be an important part of expressing yourself with technical writing. Sometimes you may find that you can say more with code than you can in plain writing. Kind of like you can say more with an image than plain writing.

How to create a code block in Google Docs

To create code blocks, you'll first have to install the code block extension. It takes a few minutes but you'll only have to do this once for each Google Account that you use.

How to install the code block extension in Google Docs

Open up a Google Doc, and then click on 'Extensions'. Select 'Add ons' and then 'Get add-ons'

Once you're in the Google Workspace Marketplace, use the search bar to search for code blocks.

In the results, look for 'Select Code Blocks', which should be the first result. Click on 'Code Blocks' to install it and grant any necessary authorization.

You now have code blocks installed, awesome! Next, we'll discuss how to create the code block.

How to create a code block in Google Docs

Now that you've got your code block add-on installed, you can now open the code block extension. Navigate to 'Extensions', and then click on 'Code Blocks' and 'Start'.

You're all set to drop in your code snippet. Just select format, and you're done!

You've now successfully used code blocks in Google Docs.

Want a better alternative to using code blocks in Google Docs?


Stashpad Docs was built to be an alternative to Google Docs made just for development teams. With out-of-the-box markdown support, you can create a doc and get started creating a code block in far fewer clicks than with Google.

In Stashpad Docs, use markdown to create a code block. Pro tip: Type ``` and then optionally type the programming language to enable syntax highlighting.

You can alternatively use the Code Block option in the bottom toolbar to create a code block.

Stashpad Docs is a minimal alternative to Google Docs that streamlines collaboration with markdown support and no account required.

It's the fastest way to start collaborating - it just takes a single click to jump into a new doc. No more permission dances or nine-click battles, just a fast and easy experience.

Try Stashpad Docs, an alternative to Google Docs, for free today.

Make your Work
Note-Worthy

Also available for .

Download Stashpad

Stay In Touch

Subscribe to the Stashpad Newsletter to receive occasional product updates and company announcements.