# path-normalize

> Zero-dependency browser-oriented path.normalize

Latest version **8.0.0** (published 2025-10-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install path-normalize
pnpm add path-normalize
yarn add path-normalize
bun add path-normalize
```

## Health

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

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

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 8.0.0 |
| Published | 2025-10-27 |
| First published | 2018-02-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=24.0.0 |
| Dependencies | 0 |
| Unpacked size | 7.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Autumn Z |
| Maintainers | zautumnz |
| Keywords | normalize, path, path-normalize |

## Links

- npm: https://www.npmjs.com/package/path-normalize
- Repository: https://github.com/zautumnz/path-normalize
- Homepage: https://github.com/zautumnz/path-normalize#readme
- Issues: https://github.com/zautumnz/path-normalize/issues
- npm.io page: https://npm.io/package/path-normalize

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 8.0.0 (latest) — 2025-10-27
- 3.0.1 (next) — 2018-08-13
- 7.0.0 — 2025-08-30
- 6.0.13 — 2024-01-02
- 6.0.12 — 2023-05-10
- 6.0.11 — 2023-04-08
- 6.0.10 — 2023-01-09
- 6.0.9 — 2022-12-10
- 6.0.8 — 2022-12-04
- 6.0.7 — 2022-09-22
- 6.0.6 — 2022-06-30
- 6.0.5 — 2022-06-04
- 6.0.4 — 2022-05-30
- 6.0.3 — 2022-05-30
- 6.0.2 — 2020-12-12
- … 54 more at https://npm.io/package/path-normalize/versions

## README

# path-normalize

Zero-dependency browser-oriented `path.normalize`.

`path-normalize` is different from
[normalize-path](http://npm.im/normalize-path); `normalize-path` only handles
slashes, while this lib is a browser-focused version of the POSIX
`path.normalize` in Node.

`path-normalize` also differs from Node's `path.normalize`. `path-normalize`
handles uri-encoded strings.

Most of this library is directly from
[Node's source](https://github.com/nodejs/node/blob/b404aa56c0e776c9722017ca020f9d04c7aa6de2/lib/path.js#L1182).
--------

## Installation

`npm i path-normalize`

## Usage

```javascript
import normalize from 'path-normalize'
// or import { normalize } from 'path-normalize'
const normal = (somePath) => normalize(somePath)
```

Slightly more real-world example:

```javascript
import normalize from 'path-normalize'

// imaginary client-side router api
router.route('/foo/*', (pathname) => {
  const normalized = normalize(pathname)
  if (normalized !== pathname) {
    router.redirect(normalized)
  } else {
    renderFoo()
  }
})
```

[LICENSE](./LICENSE.md)

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