---
title: "removeQueryParam"
description: "Remove a query parameter from a URL by key and return a new URL string, leaving the rest of the query string intact."
canonical_url: "https://core.mhaibaraai.cn/en/docs/utilities/url/remove-query-param"
---
# removeQueryParam

> Remove a query parameter from a URL by key and return a new URL string, leaving the rest of the query string intact.

## Usage

`removeQueryParam` removes a specific query parameter from a URL.

```ts
import { removeQueryParam } from '@movk/core'

removeQueryParam('https://example.com?page=1&sort=name', 'page')
// 'https://example.com?sort=name'

removeQueryParam('https://example.com?page=1', 'page')
// 'https://example.com'
```

## API

### `removeQueryParam(url, key)`

Remove a specific query parameter from a URL.

### Parameters

**url** (`string`) *required*: The URL string.

**key** (`string`) *required*: The parameter key to remove.

### Returns

**returns** (`string`): A new URL string without the removed parameter.

## Changelog

See commit history for [src/utilities/url/query.ts](https://github.com/mhaibaraai/movk-core/commits/main/src/utilities/url/query.ts).

---

- [GitHub](https://github.com/mhaibaraai/movk-core/blob/main/src/utilities/url/query.ts)


## Sitemap

See the full [sitemap](https://core.mhaibaraai.cn/sitemap.md) for all pages.
