Skip to content
Browser Screensaver

ASCII Donut Screensaver

The spinning ASCII donut — a lit, shaded torus drawn entirely out of punctuation. It is the most-shared piece of graphics code on the internet, and it turns out to make a very good screensaver.

Press F for fullscreen, Esc to exit.

What the ascii donut screensaver is

A torus is swept as two angles: one walks around the small circle of the tube, the other rotates that circle around the middle. Every point is turned on two axes, projected onto the character grid, and kept only if it is nearer than whatever was there before. The character is chosen by how the surface faces a fixed light, which is why the shape reads as lit rather than as an outline.

The original is Andy Sloane’s donut.c from 2006, written to be short enough to fit in a shape — a piece of C source code that is itself a donut. What is on screen here is real text in a real page, not a picture of it, so you can select it.

  • A terminal-looking screen for a stream, a desk display or a demo
  • The obvious background for anything about programming
  • Something to leave running on a monitor in a room full of engineers

The spinning donut, full screen in a browser

Resolution sets how many characters wide the grid is. Low values give you the chunky original, about seventy columns across; turn it up and the shading gets fine enough that the donut starts to look genuinely smooth. The character height is worked out from your screen, so it stays round rather than stretching into an oval.

The rotation control goes all the way down to a standstill, which is worth doing once to see how much of the effect is the shading rather than the movement.

How to run the ascii donut screensaver full screen

Press the fullscreen button on the player, or the F key. Escape brings you back to the page. On a desktop browser F11 does the same job and hides the browser’s own toolbars as well, which is what you want on a display that is going to be left running.

Everything you change in the settings is written into the address bar as you change it, so the version you have set up is a link. Bookmark it, or send it to whoever is running the screen. Space pauses and resumes at any time.

Questions

What is donut.c?

A short C program by Andy Sloane, published in 2006, that renders a rotating three-dimensional torus as ASCII characters in a terminal. The source is famously laid out in the shape of a donut. It has been ported to nearly every language since, and it is where this page comes from.

Which characters does it use?

The twelve characters ".,-~:;=!*#$@", ordered from dimmest to brightest. The one drawn at each position is chosen by how directly that part of the surface faces the light, which is the whole of the shading model.

Can I copy the donut as text?

Yes. It is real text on the page, not a canvas or an image, so you can select a frame and copy it. It will be the frame that was on screen when you selected it — the next one arrives a sixtieth of a second later.

Is the ascii donut screensaver free?

Yes — free, with no account, no download, no watermark and no time limit. It is a web page, so it runs on anything with a modern browser.

How do I stop it or exit fullscreen?

Press Escape to leave fullscreen, or F to toggle it. Space pauses the animation without leaving the page. If you used F11 to hide the browser toolbars, press F11 to bring them back.