ascii.rest is an animated ASCII art library with 191 free pieces under the MIT license that you add to any page with a single HTML tag, or import as a component in React, Next.js, and Astro. It includes scenes, loaders, charts, language logos, Linux distros, 3D figures, and physics simulations, all in TypeScript, with no dependencies and no build step.
The project, by developer Shubham (@bas3line), hit the front page of Hacker News on October 7th with 162 points. In the README, the author presents it as a way to add a bit of movement to minimalist terminal-style websites without giving up plain text aesthetics.
What ASCII drawings does it include?
The 191 pieces are organized into 14 categories on the site:
| Category | Pieces | Examples |
|---|---|---|
| Scenes (full color) | 13 | aurora fjord, kyoto dusk, earthrise |
| UI | 12 | spinners, progress bar, terminal, skeleton, not found |
| Data | 10 | bar chart, sparkline, gauge, heatmap, uptime bar |
| Typography | 9 | typewriter, glitch, scramble, split-flap, big text |
| Language logos | 27 | rust, go, python, typescript, zig |
| Linux distros | 22 | arch linux, debian, nixos, ubuntu |
| Figures | 12 | donut, cube, tesseract, torus knot |
| Space | 11 | black hole, solar system, three-body |
| Physics | 14 | double pendulum, falling sand, lorenz attractor |
| Nature | 16 | campfire, bonsai, snowfall, fractal tree |
| Creatures | 10 | cat, fox, jellyfish, whale |
| Objects | 14 | analog clock, lava lamp, vinyl, train |
| Generative | 13 | mandelbrot, langton’s ant, rule 30, voronoi |
| Effects | 8 | matrix rain, doom fire, synthwave, tunnel |
Included are the famous spinning ascii donut and the matrix rain.
Each piece has its own page on ascii.rest (for example, ascii.rest/donut/), where you can see it in motion before using it.
Does it work as a loader or spinner?
Yes. The UI and data categories are the most practical in the catalog. An ASCII spinner, a progress bar, a skeleton, a sparkline, or a 404 page fit well in a technical blog, documentation site, or terminal-looking dashboard.
You use them just like any other piece, by its name:
<ascii-art piece="spinners"></ascii-art>
How do I add animated ASCII art to an HTML page?
You need a script and a tag:
<script type="module" src="https://ascii.rest/ascii.js"></script>
<ascii-art piece="donut"></ascii-art>
ascii.js defines the <ascii-art> custom element, loads the piece, and plays it only while it’s visible on screen.
The element is styled like text:
ascii-art { font-size: 10px; color: teal; }
According to the README, the tag accepts these attributes:
| Attribute | What it does |
|---|---|
piece |
The name of the piece: donut, night-coast |
src |
The URL of any module that matches the piece contract |
fps |
Changes the frame rate |
options |
JSON that overrides defaults: '{"text":"hello"}' |
label |
What it displays, for screen readers |
mono |
Draws a color piece in a single ink, the text color |
Logos and distros come in their own colors. Add mono (<ascii-art piece="rust" mono>) to draw them in your text color.
How do I use ASCII art in React or Next.js?
Install the package from GitHub and import the component:
// npm install github:bas3line/ascii
import { Ascii } from "ascii.rest/react";
import { donut } from "ascii.rest/pieces";
<Ascii piece={donut} />
<Ascii piece="night-coast" /> // fetched by name when it mounts
<Ascii piece={donut} options={{ fps: 12 }} className="art" />
<Ascii piece="rust" mono /> // a logo in one ink
Ascii is a client component ("use client"), so it works as-is with Next.js App Router.
If you pass the imported module, the piece is included in your bundle. If you pass the name as text, it downloads only when the component mounts.
Text pieces are drawn in a <pre>. Color pieces (scenes, logos, and distros) are drawn in a <canvas> as wide as its container, or in a <pre> in a single ink if you add mono.
At the time this post was published, ascii.rest isn’t on the npm registry. The package installs directly from the GitHub repository as ascii.rest and compiles on its own during installation.
How do I use ASCII art in Astro?
---
import Ascii from "ascii.rest/astro";
---
<Ascii piece="donut" />
<Ascii piece="big-text" options={{ text: "hello" }} class="banner" />
The Astro component renders the first frame on the server, so the page is complete before JavaScript runs. Animation starts when the page finishes loading.
Can I use it without a framework, from TypeScript?
Yes. mount plays a piece in any element and returns a function to stop it:
import { mount } from "ascii.rest";
import { donut } from "ascii.rest/pieces";
const stop = mount(document.querySelector("pre")!, donut, { fps: 12 });
Use a <pre> for text pieces and a <canvas> for color pieces. canvas.has(name) tells you which one each piece needs. The library also exports these helper functions:
load["night-coast"]()imports any piece by its name.nameslists all pieces.isPiece(name)validates that text is an existing piece name.
All pieces, options, and frames are typed.
Does the HTML tag depend on ascii.rest in production?
Yes. The no-build route downloads each piece from ascii.rest when your page loads. For a personal site, demo, or prototype that’s fine. In production, it means your animation depends on a server you don’t control.
For production, install the package and define the tag from your own bundle:
import "ascii.rest/element";
That registers the same <ascii-art> element, but served from your build.
There’s one more detail if you use it in React. Many pieces use box and block drawing characters (─ │ ╭ █ ▄ ░) that some system fonts don’t have, especially on Android. The HTML tag and Astro component load a 3 KB subset of JetBrains Mono from ascii.rest only when the browser needs it. In React you need to add that font to your <pre> font stack; the README includes the @font-face block.
Does it respect reduced motion?
Yes, by default. If the reader has prefers-reduced-motion enabled, each piece stays on its first frame instead of animating.
mount accepts motion: true to override that behavior. The README recommends using it only behind a control that the reader chooses, like the [play anyway] button on the site.
The attribute and label prop define what screen readers announce. By default, it’s the piece name.
Is ascii.rest free?
Yes. The code and 191 pieces are MIT licensed, so you can use and modify them in commercial projects too. The language logos and distros come from devicon (MIT) and Simple Icons (CC0). They remain trademarks of their owners and are shown only to identify the language or distro. The author appreciates a link back if you use it, but it’s not required.
It works in any current browser with support for ES modules, custom elements, and IntersectionObserver. Color pieces also need ResizeObserver. Importing modules on a server for server-side rendering is safe, because nothing touches the DOM until a piece is mounted.
What about you? Where would you put an ASCII animation on your site: on a 404 page, in a loader, or on the cover of your portfolio?
- A loader or spinner
- A 404 page
- The cover of my blog or portfolio
- I’d prefer another option (tell us which)
Comment below or, if this article reached you by email, reply directly to the email: your response will be published here.
Related: Creating incredible web animations in Three.js with GSAP
