How to save tokens on AI coding for a landing page
Most of the tokens a landing page costs go on writing and rewriting code. These habits cut that down, and the last section shows how Herofold's Token saver number is calculated.
· 4 min read
Tokens go on two things: what the model reads and what it writes back. It reads your prompt, the files you attach and, in most chat tools, the whole conversation so far. A landing page is long, so a full rewrite of it is one of the most expensive answers you can ask for. The aim is simple: fewer full rewrites.
Start from code, not a description
Describing a page in words means the tool writes it from nothing, and you then correct it with more rewrites. Attaching the code of a finished page means the tool reads it once and changes only what you ask. That difference is the whole basis of Herofold's estimate, explained below.
In the payload builder, the page HTML gives the tool the code itself. With Pro it comes in the zip both as the full site and as one file with the stylesheets and scripts inlined. Using a payload walks through it.
Turn on the Token saver
The Token saver section of the builder has one switch, Lean prompt: the same picks in fewer words. When DESIGN.md is attached, the lean prompt leaves the colour tokens, breakpoints, radii and section list to DESIGN.md and keeps a short spec: the fonts, the motion libraries, the signature interaction to keep, your icon, animation and polish picks, and the rules in one line.
The builder shows both counts and the percentage before you copy. On Lumen QA with the default picks, the full prompt counts about 750 tokens and the lean one about 130. If your tool cannot take attachments, untick DESIGN.md: the lean prompt then writes the main colours, breakpoints, radius and section list into its spec line instead.
The builder counts about 1.35 tokens per word of English. That number is the size of the prompt only. DESIGN.md and the HTML are still read by the tool when you attach them.
Ask for changes, not rewrites
Once the page runs, ask for edits to named parts, and ask for only the changed code back. A tool that sends back a whole file to change one heading spends the full cost of that file.
Change only the pricing section in index.html.
Return the edited section and any CSS rules it needs, nothing else.
Do not reformat or re-send the rest of the file.Work one section at a time
A section prompt is short and so is its answer. Each of the blocks has its own prompt, with its word count shown on the Prompt tab. A stack of up to 12 blocks becomes one page prompt that states the rules and the output once at the end, not once per block. Prompting pages covers blocks and stacks in more detail.
Know when to start a new chat
A long chat carries its history: drafts you rejected, files you have since changed and instructions that no longer apply. Start a new chat when:
- the base page is built and saved, and you are moving on to edits;
- you have gone back and forth on one problem several times without progress;
- you switch to a part of the page that has nothing to do with the earlier messages;
- the tool starts to bring back things you already removed.
Carry over only what the next task needs: the current files and a short note of what is decided.
Attached: index.html (current version) and DESIGN.md.
The page is built and approved. Next task: the FAQ section only.
Keep every value in DESIGN.md. Return only the FAQ markup and its CSS.How Herofold's Token saver estimate works
Each built page shows a Token saver card with the tokens saved by starting there, comparing a Blank prompt with This payload. The page's questions and Pricing give the same method. It is an estimate, worked out like this:
- Measure the page code: the HTML, CSS and JS files in the page's folder, leaving out the media and the Arabic version of bilingual pages.
- Convert it to tokens at 3.6 characters per token, the rate Herofold uses for HTML, CSS and JS.
- From scratch: a first draft and three full rewrites, so four times the page.
- From Herofold: the model reads the code once, rewrites about a fifth of it, and reads a payload prompt of about 1,500 tokens.
- The saving is the difference between the two.
For Lumen QA the code comes to about 45,000 tokens. From scratch that makes about 180,000; from the payload about 55,600. The card shows about 125k saved, or 69% fewer. Block pages show the same kind of estimate, worked out from the block's own code.
Your own numbers depend on the tool and on how much you change. Ask for full rewrites and the saving shrinks; keep each edit small and most of it holds. Browse the pages to see the estimate on each one.