Developer Documentation

Two ways to generate the styles this site produces from your own code: a JSON endpoint you can call from any language, and a Node package that runs offline. Both are free and neither needs an API key.

HTTP API

One POST returns every style for a piece of text – all 300 the font generator shows on screen. Nothing to install, works from any language.

Read the API reference

npm package

A single dependency-free function for Node.js when you would rather not make a network call. Covers 16 of the styles rather than all of them.

Read the package reference

HTTP API

Post a piece of text and get back every style the generator knows for it, already rendered as Unicode. There is no key, no sign-up and no SDK – it is one endpoint that takes JSON and returns JSON.

POST https://www.thefancytext.com/api/font
curl -X POST https://www.thefancytext.com/api/font \
  -H "Content-Type: application/json" \
  -d '{"text": "Hello", "page": 1, "size": 20}'

There is also GET https://www.thefancytext.com/api, which returns {"status":"ok"} and nothing else. Use it as a health check.

Request parameters

The body is a JSON object. Only text is required.

Field Type Default Notes
textRequired string — The text to style. Longer than 500 characters is truncated to 500, not rejected.
page integer 1 Which page of results to return. Anything below 1 is treated as 1.
size integer 300 Results per page. Clamped to 1–1000. A full response is 332 entries – 300 styles plus 32 section headings – so size: 1000 returns everything in one call.
device string "desktop" Accepted for backward compatibility. It currently has no effect on the result.
Out-of-range values are clamped rather than refused, so a client that sends page: 0 or an oversized size still gets a usable response instead of a 400.

Response

200 OK with Content-Type: application/json; charset=utf-8.

{
  "results": [
    { "text": "Truly Elegant Fancy Text", "name": "rup5050rup_2" },
    { "text": "ใƒŸโ˜…  ๐ก๐ž๐ฅ๐ฅ๐จ  โ˜…ๅฝก", "name": "Sant Font Reverse 1" },
    { "text": "๐’†œ  ๐š‘๐šŽ๐š•๐š•๐š˜  ๐’†œ", "name": "Sant Font Reverse 2" }
  ],
  "page": 1,
  "limit": 3,
  "total_pages": 111,
  "total_results": 332
}
Field Type Notes
results array Objects of { text, name }. text is the styled string, ready to display or paste.
results[].name string The style's label. A name beginning rup5050rup_ is a section heading, not a style – see the note below.
page integer The page you asked for, echoed back.
limit integer Results per page after clamping.
total_pages integer Pages available at this limit.
total_results integer Entries available in total. Currently 332: 300 styles and 32 section headings.
Filter the headings. Entries whose name starts with rup5050rup_ are group titles used to break the list into sections on this site. Their text is the heading, not styled output. Skip them unless you want the same grouping.

Errors

Failures return a JSON body of {"error": "…"} with the status below.

Status Message Cause
400 Missing text parameter The body was not valid JSON, or had no text key.
400 Text cannot be empty text was empty or only whitespace.
500 Could not generate styles The generator failed for that input. Worth retrying once with different text.

Code examples

JavaScript

const res = await fetch('https://www.thefancytext.com/api/font', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ text: 'Hello', size: 1000 })
});

if (!res.ok) throw new Error((await res.json()).error);

const data = await res.json();

// Drop the section headings before using the list.
const styles = data.results.filter(r => !r.name.startsWith('rup5050rup_'));

console.log(styles[0].text);

PHP

$ch = curl_init('https://www.thefancytext.com/api/font');
curl_setopt_array($ch, [
    CURLOPT_POST           => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => ['Content-Type: application/json'],
    CURLOPT_POSTFIELDS     => json_encode(['text' => 'Hello', 'size' => 50]),
]);

$data = json_decode(curl_exec($ch), true);
curl_close($ch);

foreach ($data['results'] as $style) {
    if (strpos($style['name'], 'rup5050rup_') === 0) {
        continue; // section heading
    }
    echo $style['name'], ': ', $style['text'], PHP_EOL;
}

Python

import requests

r = requests.post(
    'https://www.thefancytext.com/api/font',
    json={'text': 'Hello', 'size': 1000},
    timeout=15,
)
r.raise_for_status()

styles = [s for s in r.json()['results']
          if not s['name'].startswith('rup5050rup_')]

print(len(styles), 'styles')

npm package

fancy-text-generator is a small standalone package that maps text to Unicode look-alikes without a network call. It is not the same engine as the site – it carries 16 styles rather than the full set – so reach for the HTTP API when you want everything.

  • 1.2.0 latest version
  • ISC licence
  • 0 dependencies
  • 13 KB unpacked
  • 16 styles

Install

npm install fancy-text-generator
# or
yarn add fancy-text-generator

Usage

The package exports one function. There is no named export, no bold() or italic() helper – the style is the second argument.

FN transformText(text, style) → string
const transformText = require('fancy-text-generator');

transformText('Hello', 'bold');    // ๐—ต๐—ฒ๐—น๐—น๐—ผ
transformText('Hello', 'fraktur'); // ๐”ฅ๐”ข๐”ฉ๐”ฉ๐”ฌ
transformText('Hello', 'fancy1');  // ๐Ÿ…—๐Ÿ…”๐Ÿ…›๐Ÿ…›๐Ÿ…ž

// An unknown style is not an error - the input comes back unchanged.
transformText('Hello', 'nope');    // Hello
Output is lower-case. Every character is lower-cased before it is looked up, so transformText('Hello', 'bold') returns ๐—ต๐—ฒ๐—น๐—น๐—ผ and not ๐—›๐—ฒ๐—น๐—น๐—ผ. Digits, spaces and punctuation pass through untouched.
  • CommonJS only – use require(), not import, unless your bundler interops.
  • No TypeScript definitions are shipped.
  • Runs anywhere ES6 does, in Node or in the browser through a bundler.

Style reference

Every style the package accepts, with what "Hello" becomes.

Style Output for "Hello"
bold ๐—ต๐—ฒ๐—น๐—น๐—ผ
italic โ„Ž๐‘’๐‘™๐‘™๐‘œ
boldItalic ๐’ฝ๐‘’๐“๐“โ„ด
script ๐’ฝ๐‘’๐“๐“โ„ด
fraktur ๐”ฅ๐”ข๐”ฉ๐”ฉ๐”ฌ
monospace ๐—๐–พ๐—…๐—…๐—ˆ
underline ๐’ฝฬฒ๐‘’ฬฒ๐“ฬฒ๐“ฬฒโ„ดฬฒ
strikethrough hฬถeฬถlฬถlฬถoฬถ
superscript แดดแดฑแดธแดธแดผ
subscript สฐโ‚‘โ‚—โ‚—โ‚’
fancy1 ๐Ÿ…—๐Ÿ…”๐Ÿ…›๐Ÿ…›๐Ÿ…ž
fancy2 ๐Ÿ„ท๐Ÿ„ด๐Ÿ„ป๐Ÿ„ป๐Ÿ„พ
fancy3 ใ‚“ไน‡๏พš๏พšใฎ
boldFraktur, boldScript and doubleStruck also exist but are left out of the table above: in 1.2.0 the first two return each letter twice and the third mixes several alphabets. Use fraktur, script, or the HTTP API instead.

View on npm Source on GitHub

Fair use and support

The API is open and unauthenticated because it powers the pages on this site, and opening it up costs nothing extra. There is no published rate limit, but it runs on ordinary shared hosting, so please cache what you can: for a given piece of text the response never changes, and one call with size: 1000 is far cheaper than 300 paged ones.

A link back to thefancytext.com is appreciated but not required. If you are planning something high-volume, get in touch first so it does not look like an attack.

The API returns the same styles the font generator shows on screen, and the png text generator is the hosted version of the rendering it describes.

Frequently asked questions

No. There is no key, no sign-up and no SDK. Post JSON to the endpoint and you get JSON back.

It is free. There is no published per-key limit because there are no keys, but it is shared infrastructure - keep requests reasonable, cache results you will reuse, and do not put it in a loop over a large list without pausing.

Up to 500 characters. Longer input is truncated to 500 rather than rejected, so if you send a paragraph you will get styled output for its beginning and no error to tell you so.

A JSON object with a results array of {text, name} entries, plus page, limit, total_pages and total_results. Paging defaults to 300 styles and accepts up to 1000 per request.

400 when the text parameter is missing or empty, and 500 if the generator itself fails. Both come back as JSON with an error field, so you can read the reason rather than guessing from the status code.

Yes - the endpoint sends permissive CORS headers, so fetch() from a page on another domain works. Remember that anything you send from a browser is visible to the person using it.

The API returns all 300 styles and needs a network call. The npm package is a dependency-free function that runs locally and covers 16 styles. Use the package when you want no network dependency and the common styles are enough.