# url-http

> Normalize any input into a WHATWG URL limited to HTTP and HTTPS schemes.

Latest version **1.3.18** (published 2026-08-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install url-http
pnpm add url-http
yarn add url-http
bun add url-http
```

## Health

**Score 70/100 (B)** — status: active.

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

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.3.18 |
| Published | 2026-08-05 |
| First published | 2022-04-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >= 18 |
| Dependencies | 1 |
| Unpacked size | 6.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Kiko Beats |
| Maintainers | kikobeats |
| Keywords | absolute, http, https, normalize, parse, scheme, uri, url, valid, whatwg |

## Links

- npm: https://www.npmjs.com/package/url-http
- Repository: https://github.com/Kikobeats/url-http
- Homepage: https://github.com/kikobeats/url-http
- Issues: https://github.com/Kikobeats/url-http/issues
- npm.io page: https://npm.io/package/url-http

## Dependencies (1)

- [tlds](https://npm.io/package/tlds.md) ~1.261.0

## Alternatives

- [@regle/core](https://npm.io/package/@regle/core.md) — 47.0K weekly downloads
- [typeof-arguments](https://npm.io/package/typeof-arguments.md) — 12.5K weekly downloads
- [@lokalise/projects-engine-contracts](https://npm.io/package/@lokalise/projects-engine-contracts.md) — 978 weekly downloads
- [@osjwnpm/nam-laboriosam-quibusdam](https://npm.io/package/@osjwnpm/nam-laboriosam-quibusdam.md) — 70 weekly downloads
- [@oridune/validator](https://npm.io/package/@oridune/validator.md) — 16 weekly downloads

## Recent versions

- 1.3.18 (latest) — 2026-08-05
- 1.3.17 — 2026-08-05
- 1.3.16 — 2026-08-05
- 1.3.15 — 2026-08-05
- 1.3.14 — 2026-08-05
- 1.3.13 — 2026-08-03
- 1.3.12 — 2026-07-30
- 1.3.11 — 2026-07-08
- 1.3.10 — 2026-06-19
- 1.3.9 — 2026-06-17
- 1.3.8 — 2026-06-17
- 1.3.7 — 2026-04-14
- 1.3.6 — 2026-04-03
- 1.3.5 — 2026-03-17
- 1.3.4 — 2025-12-22
- … 29 more at https://npm.io/package/url-http/versions

## README

# url-http

![Last version](https://img.shields.io/github/tag/Kikobeats/url-http.svg?style=flat-square)
[![Coverage Status](https://img.shields.io/coveralls/Kikobeats/url-http.svg?style=flat-square)](https://coveralls.io/github/Kikobeats/url-http)
[![NPM Status](https://img.shields.io/npm/dm/url-http.svg?style=flat-square)](https://www.npmjs.org/package/url-http)

> Get input as normalized WHATWG URL.

## Install

```bash
$ npm install url-http --save
```

## Usage

```js
const urlHttp = require('url-http')

!!urlHttp('https://kikobeats.com') // ==> true
!!urlHttp('https://kikobeats.com') // ==> true
!!urlHttp('mailto://kiko@beats.com') // ==> false
!!urlHttp('callto:192.168.103.77+type=ip') // ==> false
```

Beyond the scheme, it requires the host to be one the public internet can resolve: an IP literal, `localhost`, or a domain whose TLD is in the [public suffix list](https://github.com/stephenmathieson/node-tlds). Hosts such as `http://internal/` or `https://example.local/` are rejected, as are URLs carrying credentials.

If you need to run the package in a browser environment, you can save some bytes using the lightweight version, which checks the scheme only:

```js
const urlHttp = require('url-http/lightweight')

!!urlHttp('https://kikobeats.com') // ==> true
!!urlHttp('https://kikobeats.com') // ==> true
!!urlHttp('mailto://kiko@beats.com') // ==> false
!!urlHttp('callto:192.168.103.77+type=ip') // ==> false
```

## License

**url-http** © [Kiko Beats](https://kikobeats.com), released under the [MIT](https://github.com/Kikobeats/url-http/blob/master/LICENSE.md) License.<br>
Authored and maintained by Kiko Beats with help from [contributors](https://github.com/Kikobeats/url-http/contributors).

> [kikobeats.com](https://kikobeats.com) · GitHub [Kiko Beats](https://github.com/Kikobeats) · X [@Kikobeats](https://x.com/Kikobeats)

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