# humanize-string

> Convert a camelized/dasherized/underscored string into a humanized one: `fooBar-Baz_Faz` → `Foo bar baz faz`

Latest version **3.1.0** (published 2025-09-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install humanize-string
pnpm add humanize-string
yarn add humanize-string
bun add humanize-string
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 3.1.0 |
| Published | 2025-09-12 |
| First published | 2015-01-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | ^12.20.0 \|\| ^14.13.1 \|\| >=16.0.0 |
| Dependencies | 1 |
| Unpacked size | 4.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 112 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | humanize, human, pretty, capitalize, uppercase, case, camelcase, dash, hyphen, underscore, string, text, convert |

## Links

- npm: https://www.npmjs.com/package/humanize-string
- Repository: https://github.com/sindresorhus/humanize-string
- Homepage: https://github.com/sindresorhus/humanize-string#readme
- Issues: https://github.com/sindresorhus/humanize-string/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/humanize-string

## Dependencies (1)

- [decamelize](https://npm.io/package/decamelize.md) ^6.0.0

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 3.1.0 (latest) — 2025-09-12
- 3.0.0 — 2021-10-14
- 2.1.0 — 2019-04-01
- 2.0.0 — 2019-03-06
- 1.0.2 — 2018-03-23
- 1.0.1 — 2015-01-24
- 1.0.0 — 2015-01-20

## README

# humanize-string

> Convert a camelized/dasherized/underscored string into a humanized one
> Example: `fooBar-Baz_Faz` → `Foo bar baz faz`

## Install

```sh
npm install humanize-string
```

## Usage

```js
import humanizeString from 'humanize-string';

humanizeString('fooBar');
//=> 'Foo bar'

humanizeString('foo-bar');
//=> 'Foo bar'

humanizeString('foo_bar');
//=> 'Foo bar'
```

## API

### humanizeString(input, options?)

#### input

Type: `string`

The string to humanize.

#### options

Type: `object`

##### preserveCase

Type: `boolean`\
Default: `false`

Preserve the original case instead of lowercasing.

```js
import humanizeString from 'humanize-string';

humanizeString('The-NetApp-Guide-to-Kubernetes');
//=> 'The net app guide to kubernetes'

humanizeString('The-NetApp-Guide-to-Kubernetes', {preserveCase: true});
//=> 'The NetApp Guide to Kubernetes'
```

## Related

- [camelcase](https://github.com/sindresorhus/camelcase) - Convert a dash/dot/underscore/space separated string to camelcase

---
_Source: https://npm.io/package/humanize-string · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
