---
title: "Percent-encode a string for URL use"
method: POST
path: "/url-encode.php"
tags: ["encoding"]
---

# Percent-encode a string for URL use

`POST /url-encode.php`

## Request

- Base URL: `https://mate.tools/api/v1`
- URL: `https://mate.tools/api/v1/url-encode.php`
- Auth: none declared

Encodes a string for use in URLs. `mode=component` (default, RFC 3986 strict - every reserved character escaped). `mode=form` produces application/x-www-form-urlencoded (space → `+`). `mode=path` keeps `/` characters intact for use as a URL path segment.

## Request body

- object
  - `text` string, required
  - `mode` 'component' | 'form' | 'path'

## Response `200`

Success

## Other responses

- `400`: Malformed request
- `413`: Request body or text exceeds 1 MB
- `429`: Rate limit exceeded (60/min, 600/hour per IP). Includes Retry-After header.

---

[API](https://skmtc.dev/mate/apis/mate-tools-api.md) · [All operations](https://skmtc.dev/mate/apis/mate-tools-api/llms.txt) · [OpenAPI document](https://skmtc.dev/mate/apis/mate-tools-api/revisions/874670b78962?raw)
