How to Make Code Reels and YouTube Shorts

Turn a snippet into a 9:16 code animation for YouTube Shorts, Instagram Reels and TikTok. Real examples, layout tips, and an MP4 you download when it is ready.

· 6 min read

Code Animation sample: a useDebounce hook in 9:16

A 21-second 9:16 export from Code Animation: a React useDebounce hook is built in four steps, then used to search only when typing pauses. Real built-in example, Studio card.

Make a video like this with Code Animation

A code reel is a 9:16 video of a snippet, made to be watched on a phone: YouTube Shorts, Instagram Reels, TikTok, or a story. A cropped screen recording of a full-width editor usually fails here. The type is too small, the cursor jumps, and half the frame is a file tree nobody can read at arm's length.

The better version is a snippet that was laid out for a vertical frame: short steps, a readable card, a caption that names the change, and an MP4 at 1080×1920. The video above is a real export from Code Animation: a React useDebounce hook built in four steps, in the 9:16 Studio card, about 21 seconds long.

Why 9:16 needs a different layout

In 16:9 you can show a wider function and still leave a margin. In 9:16 the safe area is tight (especially with Shorts and Reels UI at the top and bottom), so the typography has to be refit, not squeezed.

Studio in 9:16 puts the code in a rounded card with the filename at the top and the caption underneath, inside that safe area. The font is sized to the card, and long lines wrap on commas and opening brackets rather than running off the edge. That is why a hook or a ten-line change works, and a 200-line component file does not.

If you want the landscape version of the same idea, see how to make an animated code video.

How to make a code reel

  1. Open Code Animation and set the aspect to 9:16.
  2. Drop a small file, paste a short snippet, or switch to Describe it and type something like "show how to debounce in React".
  3. Leave Studio selected unless you specifically want the Window chrome.
  4. Keep captions on. On a phone, the caption is often the only explanation; people watch with the sound off.
  5. Click Animate with AI, watch the preview in the vertical frame, and open Edit steps only if a line is too long or a caption is vague.
  6. Click Download MP4 when the render is done. The file is 1080×1920, H.264, 60 fps, ready to upload.

Animate with AI starts from 25 credits; failed runs are free. Writing the steps yourself and exporting the MP4 stay free, with no watermark.

A real example: useDebounce

The clip at the top of this page is the built-in "Build a useDebounce hook" example, in TypeScript, Tokyo Night, 9:16. It does one job: start from the hook signature, add the timer, clear it on the next keystroke, then show how you would use it in a search box.

Step 1 is only the shape of the hook:

import { useEffect, useState } from "react";

export function useDebounce<T>(value: T, delay = 300): T {
  const [debounced, setDebounced] = useState(value);

  return debounced;
}

Step 2 adds the setTimeout inside useEffect. Step 3 is the line that matters on a phone: return () => clearTimeout(id), with a callout that "each keystroke cancels the previous timer." Step 4 leaves the hook and shows the call site:

const [query, setQuery] = useState("");
const debouncedQuery = useDebounce(query, 400);

useEffect(() => {
  if (debouncedQuery) search(debouncedQuery);
}, [debouncedQuery]);

Finished 9:16 frame of the useDebounce example, with the search call site highlighted and a caption under the cardA still from the 9:16 export: the hook is used to search only when typing pauses.

Four short steps, one idea, a caption on every change. That is about as long as a reel should stay on a single hook.

The same tool can also render a 9:16 version of a landscape example. This is the Next.js after() change from the how-to guide, in the vertical card:

9:16 Studio card of the Next.js after() example, with the new import highlightedThe same after() refactor, laid out for a phone. Long lines wrap inside the card.

Layout tips that keep the type readable

  • One idea per reel. A hook, a one-function refactor, or a single API. If you need a series, cut a part 2 rather than cramming eight steps into 40 seconds.
  • Prefer short snippets. A card that already fills the safe area will not get more readable if you add another twenty lines. Split the file, or focus the last step on the two lines that matter.
  • Write captions as if the sound is off. "Clear the timer when the value changes" is useful. "Step 3" is not.
  • Hold the last frame. The export already holds on the finished code so a loop on Instagram or TikTok does not cut mid-sentence. Do not trim that hold off in another editor.
  • Skip the desktop chrome unless it helps. Studio's 9:16 card is built for this frame. Window chrome costs vertical space you probably need for the code.
  • Optional handle. There is a watermark field if you want @yourhandle on the clip. Leave it blank if you do not.

Upload sizes

The MP4 is 1080×1920, which is the standard frame for YouTube Shorts, Instagram Reels, TikTok and stories. You can upload the file as it is. If a platform also accepts a slightly taller 2K frame, that is optional; 1080×1920 is enough.

For a wider comparison of when to use 16:9, 9:16 or 1:1, see best video aspect ratio for social media. Code Animation itself exports 16:9 and 9:16.

If you would rather start from a library and write the animation as code, or you want a typewriter-only reel, the Shiki Magic Move alternative guide lays out those options.

Code Animation

Drop a file and AI writes a smooth animated MP4. Export runs in your browser; failed AI runs are free.

Frequently asked questions

How do I make a code reel or YouTube Short?

In Code Animation, set the aspect to 9:16, drop a short snippet or describe the topic, and click Animate with AI. Download the 1080×1920 MP4 when the render is done and upload it to Shorts, Reels or TikTok.

What size is the export?

9:16 exports are 1080×1920, H.264, 60 fps. That is the standard frame for YouTube Shorts, Instagram Reels, TikTok and stories.

Why not just crop a screen recording?

A full-width editor cropped to 9:16 usually leaves the type too small to read on a phone. A snippet laid out in a vertical card, with captions, stays legible at arm's length.

How long should a code reel be?

Long enough for one idea: a hook, a small refactor, or a single API. The useDebounce example on this page is about 21 seconds in four steps. If you need more, cut a part 2.

Try it on your code

Drop a file and AI writes a smooth animated MP4. Export runs in your browser; failed AI runs are free.

Open Code Animation