---
title: 'To Caption'
url: 'https://code-evolve.com/products/to-caption'
markdown: 'https://code-evolve.com/products/to-caption.md'
date: '2026-09-25'
description: 'To Caption To Caption turns identifiers into readable captions: fooBar, foo_bar, foo.bar and foo-bar all become Foo Bar View To Caption Documentation at To Caption Docs Download at to-caption on NPM Benefits Label a form field, a table column or a menu item straight from the property name behind i…'
---

# To Caption

To Caption turns identifiers into readable captions: `fooBar`, `foo_bar`, `foo.bar` and `foo-bar` all become **Foo Bar**

View To Caption Documentation at [To Caption Docs](https://code-evolve.com/resources/to-caption)

Download at [to-caption on NPM](https://www.npmjs.com/package/to-caption)

## Benefits

- Label a form field, a table column or a menu item straight from the property name behind it
- One set of rules covers camelCase, PascalCase, snake\_case, kebab-case and dotted paths
- Leading, trailing and repeated delimiters disappear, so `__foo--bar__` still reads Foo Bar
- A choice for all-uppercase names: keep `HTTP` as it is, title-case it, or space it out letter by letter
- `null` and `undefined` give an empty string rather than an error
- No runtime dependencies, and TypeScript declarations included

## How it works

The string is split into words at dots, underscores and dashes. Each word's first character is uppercased and a space goes before every later capital, so `thisIsATest` becomes This Is A Test. Every other character, including spaces and slashes, is kept as it is.

A string with no lowercase letters would otherwise become one word per letter (H E L L O). The `onAllUppercase` option chooses what happens instead.

## Try it today

to-caption has been on NPM since 2017 and is MIT licensed

[to-caption on NPM](https://www.npmjs.com/package/to-caption)

---

## Navigation

- Previous: [Label Filter](https://code-evolve.com/products/label-filter.md)
