What is a rainbow text generator?
A rainbow text generator turns plain text into coloured HTML, one colour per letter. Type "Rainbow" and you get seven letters in seven colours — red, orange, yellow, green, blue, indigo, violet — wrapped in HTML spans you can copy into a web page, a forum post, or a blog. The default text here has 7 letters, so the output has 7 spans.
The effect is a classic of the early web, and it is still used wherever text needs to stand out: a birthday message, a social media bio, a forum signature, a heading on a personal page. Colour is the cheapest decoration there is — it costs no images, no fonts, and no loading time.
This generator produces plain HTML with inline styles, which is the most portable form. It works anywhere HTML is accepted, and the colours are set with HSL values, so each letter's colour is exact and consistent across browsers.
Rainbow text works best on short strings, because the colour cycle needs room to show. A single word of five to ten letters shows the rainbow palette, so each letter has a distinct colour and the whole word reads as a rainbow. A long paragraph cycles through the spectrum many times, which still looks colourful but loses the sense of a single sweep. The generator colours each letter in turn, so the first letter is always the same colour for a given mode, and the pattern is predictable — run the same text twice and the colours come out the same.
How rainbow text works
The method is simple: walk through the text letter by letter, and give each letter the next colour in the rainbow sequence. The first letter is red, the second orange, the third yellow, then green, blue, indigo, and violet — and the eighth letter starts again at red. Spaces and line breaks are left alone, so the shape of your text never changes.
Each letter is wrapped in a span tag with an inline style, like <span style="color:hsl(0,100%,50%)">R</span>. The colour is written as an HSL value — hue, saturation, lightness — because hues are easy to step through: red is 0, orange is 30, yellow is 60, green is 120, blue is 240, and violet is 280 on the 360-degree colour wheel.
Three styles are available. Rainbow uses full saturation at 50% lightness, which is the bold classic look. Vivid uses a slightly different set of hues for a punchier feel. Pastel drops the saturation to 70% and raises the lightness to 75%, which gives soft colours that suit a light background. The default text has 7 letters, so all three styles produce 7 spans — only the colours change.
Rainbow, vivid, or pastel: which style to pick
Rainbow is the default and the right choice for most uses. Full saturation at middle lightness gives the strongest colours, which read well on both white and dark backgrounds. It is the look people picture when they hear "rainbow text".
Vivid suits short, loud text: a headline, a sale banner, a birthday greeting. Its hues are shifted toward the warm end, so the text feels energetic. On a white background it is the most eye-catching of the three, but it can be tiring to read in a long paragraph — keep it to a few words.
Pastel suits longer text and light designs. Soft colours at 75% lightness are gentle on the eyes, which makes them better for a bio, a quote, or a greeting card. Pastel on a dark background is harder to read, so use it on white or pale backgrounds only. Try all three on the same text and compare before you publish.
The mode changes the feel of the result more than the colours themselves. Rainbow mode uses full saturation and full lightness steps, which gives the brightest result and the strongest contrast between neighbouring letters. Vivid mode tightens the range so the colours stay punchy without going neon, and pastel mode lowers the saturation so the letters look soft, which suits a light background better than a dark one. The choice is a design decision, not a technical one, and the preview is the fastest way to judge it.
A worked example: colouring a word
Take the default text, "Rainbow" — 7 letters. The generator walks through it: R gets red (hue 0), a gets orange (hue 30), i gets yellow (hue 60), n gets green (hue 120), b gets blue (hue 180), o gets indigo (hue 240), and w gets violet (hue 280). Seven letters, seven spans, and the output is a single line of HTML you can paste anywhere.
Try a longer phrase, such as "Happy Birthday" — 13 letters plus a space. The space is left alone, so the letters still number 13 and the spans still number 13. The colours cycle: the eighth letter starts again at red, so a long phrase repeats the rainbow twice. That repetition is what makes the effect read as a rainbow rather than a random set of colours.
Paste the output into a page that accepts HTML and the word appears in colour at once. If the page strips HTML — many social media bios do — the spans will show as code instead of colour. Check whether your platform accepts HTML first; if it does not, a screenshot of coloured text is the workaround.
Who uses a rainbow text generator, and why
Social media users are the main group. A coloured name in a forum signature, a rainbow heading on a personal page, or a bright birthday message all stand out in a feed of plain text. Colour is the fastest way to make a short message noticeable.
Teachers and parents are the second group. Coloured letters help young children learn the alphabet, and a rainbow word on a worksheet or a classroom display is more inviting than black text. The generator is also useful for party invitations and greeting cards made at home.
Web designers are a third group, and they use it for prototypes. A rainbow heading marks a section as a placeholder, or tests whether coloured text is readable against a new background. A colour picker pairs well here, since it gives the exact hex value of any colour you want to match.
Rainbow text vs other text tools
Rainbow text changes how text looks; other text tools change what it says or how it is measured. A case converter changes capitalisation, which is a style change like colour, but it works on the letters themselves rather than wrapping them. A word counter measures the text without changing it at all.
The closest relative is the text shadow generator, which also styles text with code — it adds a shadow behind each letter instead of colouring the letter itself. The two effects combine well: rainbow letters with a soft shadow read clearly on almost any background, and both are pure CSS with no images.
Both tools produce code you paste, not an image you download. That is the advantage: the text stays selectable, searchable, and readable by screen readers, which an image of coloured text is not. If you need an image, take a screenshot of the coloured text instead.
Common rainbow text mistakes
The first mistake is rainbow-colouring a long paragraph. Seven colours repeating across hundreds of words is hard to read and looks messy. Rainbow text works for a word, a name, or a short heading — never for body text. If the text is longer than a line, colour only the heading.
Second: using rainbow text on a busy background. Bright colours on a patterned image or a coloured background clash and hurt readability. Rainbow text needs a plain background — white, black, or a pale solid colour — so the letters themselves carry the colour.
Third: pasting the HTML where HTML is not accepted. Instagram bios, WhatsApp messages, and most comment boxes show the raw tags instead of coloured letters. Test the output in your platform before you send it to anyone, and keep a plain-text version ready.
Fourth: forgetting accessibility. Some readers are colour-blind, and rainbow text that relies on colour alone can be hard to follow. Keep the words themselves clear and simple, and never use colour as the only way to mark something important — a word in red means nothing to a reader who cannot tell red from green.
A second mistake is copying rainbow text into a place that strips the colour. A plain text message, a form field, or a document that only keeps characters will show the letters with no colour at all, because the colour lives in the HTML tags around each letter, not in the letters themselves. The output box offers two forms — the coloured preview and the HTML code — and only the HTML code carries the colour into another page. Paste the code into a page or an editor that accepts HTML, and the colours survive.
How to use this rainbow text generator
Type your text into the box — the default is "Rainbow", 7 letters. Pick a style: Rainbow, Vivid, or Pastel. The HTML output updates live in the box below, with one span per letter — 7 spans for the default text.
Use the Copy button next to the output box to copy the HTML, then paste it into your web page, forum post, or blog. The text will appear in rainbow colours at once. If your platform does not accept HTML, the tags will show as code — in that case, take a screenshot of the coloured text instead.
Everything runs in your browser. No sign-up, no account, no data sent anywhere — your text never leaves your device. It works offline once the page has loaded. Try it with a name or a short greeting first, and check how it looks on your background before you use it anywhere public.
Type or paste the text, pick a mode, and the preview updates at once. Each letter is wrapped in its own span with an inline colour, and the HTML output below the preview is the code to copy. If the text is long, shorten it first — a short string shows the rainbow better than a long one. When the preview looks right, copy the HTML and paste it into the page, post, or document where the coloured text belongs, and check that the background there is light enough for the colours to read.