Design
Optimal line length API
Converts a target characters-per-line into a px/rem/ch measure using font size and glyph-width factor, and flags whether it sits in the readable 45-75 CPL band (66 ideal). Answers 'How wide should my text column be for 66 characters per line at 16px?', 'Is a 120-character measure too wide?'.
Price$0.04per request
MethodPOST
Route/v1/design/optimal-line-length
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
designtypographyline-lengthmeasurecharacters-per-linecplreadabilitymax-width
API URL
Integration docshttps://x402.hexl.dev/v1/design/optimal-line-lengthExample request
{
"fontSizePx": 16,
"charactersPerLine": 66
}Example response
{
"fontSizePx": 16,
"charactersPerLine": 66,
"avgCharWidthEm": 0.5,
"measurePx": 528,
"measureRem": 33,
"measureCh": 66,
"cssMaxWidth": "66ch",
"readableBand": {
"minCpl": 45,
"idealCpl": 66,
"maxCpl": 75,
"inBand": true
},
"interpretation": "Measure is within the comfortable reading band."
}Input schema
{
"type": "object",
"required": [
"fontSizePx"
],
"properties": {
"fontSizePx": {
"type": "number",
"description": "Font size in px",
"examples": [
16
]
},
"charactersPerLine": {
"type": "number",
"description": "Target CPL (default 66)",
"examples": [
66
]
},
"avgCharWidthEm": {
"type": "number",
"description": "Average glyph width in em (default 0.5)",
"examples": [
0.5
]
}
}
}Output schema
{
"type": "object",
"additionalProperties": true
}