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.
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 referenceHTTP 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.
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. |
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. |
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.
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
transformText('Hello', 'bold') returns
๐ต๐ฒ๐น๐น๐ผ and not ๐๐ฒ๐น๐น๐ผ. Digits, spaces and punctuation
pass through untouched.
- CommonJS only – use
require(), notimport, 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.
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.
- Report a bug or request a style on GitHub.
- Contact us about anything else, including high-volume use.