A web app for creating Cookie Clicker gift codes. Choose how many cookies to send (1–1000), write an optional note, pick a box design, and copy the code it generates.
To redeem a code, paste it into Cookie Clicker's "Redeem a gift" option. Like the game, codes expire after a day or two, so generate a new one rather than reusing an old one.
A gift code is this string, encoded as UTF-8 and then Base64:
MAIL|<timestamp>|<cookies>|<box design>|<message>|
| Field | Description |
|---|---|
timestamp |
When the gift was created, in milliseconds since 1970 (Date.now()) |
cookies |
Whole number from 1 to 1000 |
box design |
Position of the box's icon in the game's sprite sheet, as column row (e.g. 34 6) |
message |
Up to 4 lines of 25 characters each; any | is replaced with /$/ |
The encoding code is in src/utils/encode.ts.
Built with React, TypeScript, Vite and Tailwind CSS.
npm install
npm run dev # start the dev server (shows type and lint errors as you work)
npm run build # type-check and build into dist/
npm run preview # serve the built app
npm test # run the tests once
npm run test:watch # re-run the tests on every change
npm run lint # run oxlint
npm run format # format all files with Prettier
npm run format:check # check formatting without changing anything
Every push to main and every pull request runs lint, the format check, the tests and the build on GitHub Actions.
src/
App.tsx holds the shared state and switches between the two windows
components/
encode-window.tsx the "Send a Gift" window: cookie amount, note, box picker, gift code
custom-gift-window.tsx the "Custom Gift Icon" window: pick any icon from the game
gift-button.tsx one icon as a selectable button, used by both windows
window.tsx, window-title.tsx the framed window and its feathered title
utils/encode.ts builds the gift code
utils/message.ts enforces the note's 4-line, 25-characters-per-line limit
utils/cookies.ts turns the cookie input into a whole number from 1 to 1000
utils/gifts.ts the preset gift boxes and their names
utils/custom-icons.ts every usable icon in the sprite sheet, for the custom gift window
utils/sprite.ts finds an icon's position in the sprite sheet
index.css styles that copy the game's look
public/ images taken from the game (sprite sheet, frame, backgrounds)
Tests sit next to the code they test, as *.test.ts.
The app is hosted on Cloudflare Pages at cookie-clicker-gift-code-generator.jacob-jordan.me. Every push to main deploys automatically, and other branches get their own preview addresses. Pages builds straight from the repository with these settings:
| Setting | Value |
|---|---|
| Build command | npm run build |
| Output directory | dist |
Cloudflare reads the Node.js version from .node-version.
This is a fan-made tool and isn't affiliated with Orteil or DashNet. The images in public/ come from Cookie Clicker and belong to their creators.
The source code is available under the MIT License. The license doesn't cover the Cookie Clicker images in public/ (see Disclaimer).