Eskillsfy

Home / Blog / Images

Images · 23 Nov 2026

Meme Generator: how it works and how to build one

Add top and bottom captions to any image. This guide explains what happens behind the button and shows the code, so you can build your own.

What it does

Open an image, add classic bold captions at the top and bottom (or anywhere), change size, color and outline, and download. Works with your own photos; nothing is uploaded.

When to use it

  • Social posts
  • Team chats
  • Marketing with humour

How to use it

  1. Open an image.
  2. Type the captions and style them.
  3. Download the meme.

Try it free in your browser, nothing is uploaded: https://eskillsfy.com/tools/meme-generator

How it works

A classic meme caption is white Impact-style text with a black outline. On canvas that is strokeText (with a thick lineWidth and round joins) followed by fillText at the same spot.

Captions wrap by measuring words, and their size is a percentage of the image width so they look right on any photo.

Build it yourself

Here is the core of the tool. It has no dependencies unless noted, so you can paste it into any TypeScript or JavaScript project.

meme.ts (ts)

export function caption(c: HTMLCanvasElement, text: string, yPercent: number) {
  const g = c.getContext("2d")!, size = c.width * 0.09;
  g.font = `900 ${size}px Impact, "Arial Black", sans-serif`;
  g.textAlign = "center"; g.lineJoin = "round";
  g.lineWidth = size / 8; g.strokeStyle = "#000"; g.fillStyle = "#fff";
  const y = (yPercent / 100) * c.height;
  g.strokeText(text.toUpperCase(), c.width / 2, y);
  g.fillText(text.toUpperCase(), c.width / 2, y);
}

Make it production-ready

  • Wrap long captions onto several lines.
  • Let users drag captions on the image.

Questions

Can I use any image?

Use images you have the right to share.

Try the Meme Generator

Free, runs in your browser, nothing is uploaded.

Open it
Keep reading

More in Images

All posts