Wrap and indent text
Hard-wrap text to a line width, add or remove indentation, and put a prefix such as "> " on every line.
Input
Result
Fill in the input and press Run.
Your input is processed in memory and then discarded. It is not stored or logged. Even so, don't paste live passwords or keys into any online tool.
Use it from code or an agent
curl -s https://setget.net/v1/tools/wrap-indent \
-H 'Content-Type: application/json' \
-d '{"input":{"text":"The quick brown fox jumps over the lazy dog.","width":20,"prefix":"> "}}'
import json, urllib.request
body = {'input': {'text': 'The quick brown fox jumps over the lazy dog.', 'width': 20, 'prefix': '> '}}
request = urllib.request.Request("https://setget.net/v1/tools/wrap-indent", json.dumps(body).encode(),
{"Content-Type": "application/json"})
print(json.load(urllib.request.urlopen(request))["result"])
const response = await fetch("https://setget.net/v1/tools/wrap-indent", {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify({"input":{"text":"The quick brown fox jumps over the lazy dog.","width":20,"prefix":"> "}}),
});
console.log((await response.json()).result);
Tool: run_tool
Arguments:
{
"slug": "wrap-indent",
"input": {
"text": "The quick brown fox jumps over the lazy dog.",
"width": 20,
"prefix": "> "
}
}
{
"input": {
"text": "The quick brown fox jumps over the lazy dog.",
"width": 20,
"prefix": "> "
}
}
Endpoint: POST /v1/tools/wrap-indent. Over MCP: run_tool with slug: "wrap-indent".
Machine-readable: input schema, Markdown. Connect an agent.
Inputs
| Name | Type | Required | What it does |
|---|---|---|---|
text |
string | yes | The text to wrap or indent. |
width |
integer | no | Longest line allowed, counting the indent and prefix. 0 leaves line lengths alone. Default: 80. From 0 to 10000. |
indent |
integer | no | Spaces to add to every line. A negative number removes up to that many leading spaces. Default: 0. From -100 to 100. |
prefix |
string | no | Text put at the start of every line, for example "> " or "# ". Default: "". |
reflow |
boolean | no | Join the lines of each paragraph before wrapping, so short lines are filled up. Default: false. |
dedent |
boolean | no | First remove the indentation that all lines have in common. Default: false. |
Examples
Input
{
"text": "The quick brown fox jumps over the lazy dog.",
"width": 20,
"prefix": "> "
}Result
{
"text": "> The quick brown\n> fox jumps over the\n> lazy dog.",
"lines": 3
}Indent only
Input
{
"text": "def f():\n return 1",
"width": 0,
"indent": 4
}Result
{
"text": " def f():\n return 1",
"lines": 2
}Reflow paragraphs
Input
{
"text": "one\ntwo\nthree\n\nfour",
"width": 12,
"reflow": true
}Result
{
"text": "one two\nthree\n\nfour",
"lines": 4
}Questions
- Are long words split?
- Only when a single word is longer than the width. Otherwise lines break at spaces.
- What happens to a line's own indentation?
- It is kept, and the continuation lines created by wrapping get the same indentation.
- How is width measured?
- In characters. Wide characters such as Chinese or emoji count as one, so they may look wider on screen.
Related tools
- Line numbersAdd line numbers to text with your choice of start, padding and separator, or strip them off again.
line-numbers - Truncate textShorten long text to a maximum length, cutting from the middle, start or end and marking the cut with an ellipsis.
truncate-middle - Text chunkerSplit long text into chunks of a maximum size for search and RAG pipelines, breaking at natural boundaries.
text-chunk - Apply a patchApply a unified diff to a text and get the patched result, with clear errors when a hunk does not fit.
patch-apply - Case converterConvert text between lower, UPPER, Title, Sentence, camelCase, PascalCase, snake_case, kebab-case and more.
case-convert - Escape and unescape textEscape or unescape text for HTML, URLs, JSON strings, shell commands, regular expressions and CSV fields.
escape-unescape