Trinket alternative

Trinket has shut down. Here's how to keep your code examples runnable.

Trinket.io closed on 31 August 2026, and every embedded trinket went with it. If your course pages, blog or school site had runnable Python or Java, this page shows what can replace those embeds, what can't, and how to swap them over.

By the OnlineCompiler.io team. Updated . We make OnlineCompiler.io, so we're one of the options here. Every competitor figure links to the vendor's own page, and we say where our API falls short.

What happened

Trinket announced in January 2026 that it would stop operating, and shut down on 31 August 2026. Users could download their trinkets until then; now the site, its embeds and its content are gone, and Trinket says it can't recover them. The software was released as open source (CC0), and a community copy runs at trinket.strivemath.org without the old content. Trinket pointed teachers to Pickcode, Dodona and Kita.

Is OnlineCompiler.io the right replacement?

It replaces one part of Trinket: runnable text-based examples embedded in your own pages. Check what you used Trinket for:

You used Trinket forOnlineCompiler.io
Runnable Python examples on your siteYes. Readers edit and run the code; Reset brings back yours. Python 3.14 with the standard library.
Java examplesYes. Java on OpenJDK 25, plus C, C++, C#, Go, Rust and 5 more languages.
Programs that use input()Partly. Readers type the input in the Input tab before running, rather than answering prompts one at a time.
Free, with no ads or sign-in for readersYes. 100,000 runs a month free, including commercial use.
Turtle, Pygame, GlowScript or plotsNo. Programs return text only. turtle doesn't import, and NumPy and Matplotlib aren't installed.
HTML, CSS and JavaScript pages, Blocks, R or musicNo. These are languages and editors we don't offer.
Classes, assignments and saved student workNo. There are no student accounts. Pickcode, Dodona and Kita do this.
Embedding in a site that only accepts an iframeYes. The iframe embed carries the code in its URL.

Swapping a Trinket embed

A Trinket embed was an iframe pointing at code stored on trinket.io:

Before: Trinket
<iframe src="https://trinket.io/embed/python3/a1b2c3d4e5" width="100%" height="400"
  frameborder="0" marginwidth="0" marginheight="0" allowfullscreen></iframe>

The widget keeps the code in your page instead, so it can't disappear with someone else's site, and search engines can read it. Create a widget key on the Widgets page of your dashboard, restricted to your domain, then:

After: OnlineCompiler.io
<!-- Once per page, or once in your site's layout -->
<script src="https://onlinecompiler.io/widget.js"></script>

<!-- Each example -->
<div class="runcode" data-key="YOUR_WIDGET_KEY" data-lang="python-3.14" data-theme="light">
<pre>
name = input("What's your name? ")
for letter in name:
    print(letter.upper())
</pre>
<pre data-stdin>Ada</pre>
</div>

If your site or course platform takes an iframe but strips scripts, use the iframe embed instead. The code and input travel in the part of the URL after the #, which browsers don't send to any server. The embed builder writes the iframe for you:

After: OnlineCompiler.io, as an iframe
<iframe src="https://api.onlinecompiler.io/embed/?key=YOUR_WIDGET_KEY&amp;lang=python-3.14&amp;theme=light#code=name%20%3D%20input(%22What's%20your%20name%3F%20%22)%0Afor%20letter%20in%20name%3A%0A%20%20%20%20print(letter.upper())&amp;input=Ada"
  title="Runnable Python example" width="100%" height="400" style="border: 0" loading="lazy"></iframe>
Trinket embed optionWidget
heightdata-height, the editor's height in pixels; by default it fits the code
outputOnly, start=resultdata-readonly shows the code without letting readers edit it; output appears when they run it
Python or Python 3 trinketdata-lang="python-3.14"
Java trinketdata-lang="openjdk-25"
Light pagedata-theme="light", or auto to follow the reader's setting

If your pages are built with a docs tool such as MkDocs, Docusaurus or Sphinx, see runnable code examples in docs for the setup that keeps your code blocks as they are.

Python differences to expect

  • Real Python 3.14. Trinket's "Python" ran Skulpt in the browser; here the code runs on CPython 3.14 on a server, with the full standard library.
  • Input up front. Prompts and answers don't interleave: the output shows the prompts, and the input comes from the Input tab.
  • Text only. No turtle, no drawing, no third-party packages such as NumPy.
  • Limits: each run gets 30 seconds, 512 MB of memory and no internet access. That suits exercises and examples, not long simulations.

Frequently asked questions

Can I keep using an iframe, as with Trinket?

Yes. The iframe embed takes the code in its URL, so you paste one iframe per example, as you did with Trinket. Use it where your site or course platform strips script tags; elsewhere the script widget keeps the code readable in your page.

Is Trinket coming back?

Trinket.io shut down on 31 August 2026. Its code was released as open source (CC0), and a community member runs a copy at trinket.strivemath.org, but none of the trinket.io content moved there.

Can I get my old trinkets back?

Not from Trinket: downloads closed with the site, and Trinket says it cannot recover content or accounts. If you downloaded a zip before the shutdown, or the code is still in your course notes, you can paste it into a new embed.

Does OnlineCompiler.io run turtle graphics?

No. Programs run on a server and send back text, so turtle, Pygame, GlowScript and plots don't work. For graphics, look at the replacements Trinket itself suggested, such as Pickcode.

Is it free for schools and teachers?

Yes. The free plan includes 100,000 runs a month and allows commercial use, with no credit card. Readers and students don't need accounts.

Does input() work?

Yes, with one difference from Trinket: readers type the input in the Input tab before pressing Run, instead of answering each prompt as the program asks. The program reads those lines in order.