> For AI agents: the complete documentation index is available at https://massaman.dev/llms.txt, the full documentation bundle is available at https://massaman.dev/llms-full.txt.

# pascalCase es-toolkit

Converts a string to pascal case.

```typescript
const converted = pascalCase(str);
```

## Usage

### `pascalCase(str)`

Use `pascalCase` when you want to convert a string to pascal case. Pascal case is a naming convention where the first letter of each word is capitalized and words are joined without separators.

```typescript
import { pascalCase } from 'es-toolkit/string';

// Basic usage
pascalCase('pascalCase'); // 'PascalCase'
pascalCase('some whitespace'); // 'SomeWhitespace'

// Words connected with hyphens or underscores
pascalCase('hyphen-text'); // 'HyphenText'
pascalCase('snake_case'); // 'SnakeCase'

// Handling consecutive uppercase letters
pascalCase('HTTPRequest'); // 'HttpRequest'
pascalCase('XMLHttpRequest'); // 'XmlHttpRequest'
```

It also correctly handles strings with various separators.

```typescript
import { pascalCase } from 'es-toolkit/string';

// Mixed separators
pascalCase('camelCase-with_mixed.separators'); // 'CamelCaseWithMixedSeparators'

// With numbers
pascalCase('version2.1.0'); // 'Version210'

// With special characters
pascalCase('user@email.com'); // 'UserEmailCom'
```

#### Parameters


strstringrequired

The string to convert to pascal case.

#### Returns

Returns a new string converted to pascal case.

```typescript
string
```

## Try It

::: sandpack

```ts index.ts
import { pascalCase } from 'es-toolkit/string';

console.log(pascalCase('pascalCase'));
```

:::


Source: es-toolkit

Re-exported verbatim from [`es-toolkit`](https://es-toolkit.dev/reference/string/pascalCase.html). Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.
