How to Save and Share Code Snippets on glot.io

Updated

On glot.io, you save a snippet by running or writing code in the playground and then choosing a visibility level — public, unlisted, or secret — before sharing the resulting link yourself. This works for any of the supported languages, and the saved snippet can be reopened later to edit or run again. The main constraint to keep in mind: code executes in a temporary container with network access disabled, so a snippet that depends on external requests won't behave the same way when someone else runs it.

Saving a snippet

The playground is built around a simple loop: select a language, write code, run it, then save it if you want to keep or share it.

  1. Select a language from the language list (Assembly, Bash, C, Clojure, Go, Python, Rust, TypeScript, and dozens more).
  2. Write or paste your code into the editor.
  3. Run it to confirm it behaves as expected. Execution happens in a temporary container with network access disabled.
  4. Save the snippet and pick a visibility level: public, unlisted, or secret.

The save step is what turns a throwaway run into something you can return to. Once saved, the snippet can be executed or edited again rather than being lost when you close the tab.

What the three visibility levels mean

Visibility Who can find or open it When to use it
Public Anyone; it can be discovered through the site Examples, demos, answers you want others to find
Unlisted Anyone with the link, but not surfaced for discovery Sharing with a specific person or a small group
Secret Only you, unless you choose to share Drafts, personal notes, work in progress

The distinction that matters most is between unlisted and secret: unlisted is link-accessible, secret is not shared until you decide to share it. If you're unsure, saving as secret first and changing your mind later is the safer order.

Sharing a snippet

Sharing on glot.io is deliberate rather than automatic — you control when a link goes out.

  • Save the snippet at the visibility you want.
  • Copy the snippet's link.
  • Send it through whatever channel you prefer (chat, email, issue tracker, documentation).

Because unlisted and secret snippets aren't discoverable on their own, the link is the share. That also means you can prepare a snippet, keep it private, and only distribute it when the code is ready.

Things that trip people up

Network access is disabled during execution. A snippet that calls an API, fetches a URL, or installs a package at runtime will fail or behave differently than it would locally. If your example needs network access, describe the expected response in comments instead of relying on a live call.

The container is temporary. Each run starts fresh, so don't expect files, environment variables, or state from a previous run to persist. Anything the snippet needs must be inside the snippet itself.

Visibility is a sharing decision, not a security guarantee. Secret means "not shared until you share it," which is the right mental model for drafts — not a place for credentials, tokens, or anything you wouldn't want exposed if a link leaked.

Editor key bindings are configurable. If Vim or Emacs muscle memory keeps interfering, the editor supports both key binding styles, so you can work in the mode you're used to.

A practical workflow

For a snippet you plan to hand to someone else:

  1. Write and run it until the output is correct.
  2. Save it as secret while you clean up comments and edge cases.
  3. Switch to unlisted if you're sharing with one person, or public if it's meant to be found.
  4. Send the link and note any assumptions — especially if the code would normally need network access.

If a language you want isn't in the list, glot.io is open source, so you can open an issue or pull request on GitHub to get it added.