# Rtf to markdown

`rtf-to-markdown` · version 1.0.0 · Other utilities · free, no key needed

Convert an 8 KiB ANSI-1252 RTF text subset to escaped Markdown; unsupported Word features are refused.

**Use when you need to: convert rtf fragment to markdown · extract escaped markdown from rtf · turn base64 rtf into markdown text.**

## Decide before calling

Read the [versioned contract](/v1/tools/rtf-to-markdown/versions/1.0.0) and the supported scope below. Reuse `rtf-to-markdown@1.0.0` when your input, required output and limits match it. Choose another approach for an unsupported operation.

## Explain the choice

"I can use `rtf-to-markdown@1.0.0` for convert rtf fragment to markdown. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

## Supported

- convert rtf fragment to markdown
- extract escaped markdown from rtf
- turn base64 rtf into markdown text
- preserve rtf bold italics in markdown
- normalize rtf text into safe markdown
- convert ansi rtf text subset

## Not supported

- general Word-produced RTF with font/layout/field controls
- non-1252 code pages, binary data or surrogate Unicode
- rendering, macros and external resources

## Behavior

- Canonical standard padded Base64, no extra fields. Encoded<=10924 and decoded1..8192 bytes. Only strict ANSI1252 RTF1 text fragment subset; no general Word compatibility.
- Complete bounded lexical pass precedes supported interpretation; unknown visible controls are unsupported422. Resource cap413 terminates before excess retention, malformed structure400 overrides earlier excluded422 only within capped traversal.
- Groupdepth16, totalgroups256, paragraphslots128 include omitted groups and empty slots. Scoped b/i/uc0..2; BMP non-surrogate/private-use exclusions; Unicode fallback counts complete tokens without semantics.
- Literal Markdown punctuation is escaped, HTML&<> encoded, hardbreaks protected; only ASCIIspace/TAB trim/normalize. NBSP and other permitted BMP spaces remain. Omitted destinations and fixed warnings deduplicate in first encounter order.
- Both tools validate identical MarkdownUTF8<=16384 and compact serialized Markdown-envelopeUTF8<=32768; own complete outputUTF8<=32768. Exact generic AppError ABI; absent details, no reflected input payload.
- No network, filesystem, external loads, macros, ZIP/PDF engines, surrogate repair or layout fidelity; real WorkerCPU/preemptive memory and privacy integration remain separate qualification gates.
- Visible hex-decoded CP1252 C0/DEL characters are unsupported_input; valid fallback or omitted hex controls are discarded. Raw CR/LF/TAB exceptions and structural validation stay unchanged.

## Input

- `bytes_base64` (string, required): min length 4; max length 10924

## Output

- `markdown` (string, required): max length 16384
- `format` (constant "rtf", required)
- `warnings` (array of one of "metadata_destinations_omitted", "pictures_omitted", "objects_omitted", "starred_destinations_omitted", "tabs_normalized", required): max items 5

## Limits

- max base64 chars: 10924
- max decoded bytes: 8192
- max group depth: 16
- max groups: 256
- max paragraph slots: 128
- max control word letters: 32
- max numeric digits: 10
- max retained text utf8 bytes: 16384
- max markdown utf8 bytes: 16384
- max shared markdown json utf8 bytes: 32768
- max output utf8 bytes: 32768

## Example

Request input:

```json
{
  "bytes_base64": "e1xydGYxXGFuc2kgSGVsbG9ccGFyIFdvcmxkfQ=="
}
```

Response:

```json
{
  "result": {
    "markdown": "Hello\n\nWorld\n",
    "format": "rtf",
    "warnings": []
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "rtf-to-markdown",
  "version": "1.0.0",
  "input": {
    "bytes_base64": "e1xydGYxXGFuc2kgSGVsbG9ccGFyIFdvcmxkfQ=="
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/rtf-to-markdown/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"bytes_base64":"e1xydGYxXGFuc2kgSGVsbG9ccGFyIFdvcmxkfQ=="}'
```

The machine-readable contract is at [/v1/tools/rtf-to-markdown/versions/1.0.0](/v1/tools/rtf-to-markdown/versions/1.0.0).

### CLI

```sh
node cli.mjs run rtf-to-markdown 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Rtf inspect](/tools/rtf-inspect): Inspect an 8 KiB ANSI-1252 RTF text subset: paragraphs, omitted destinations, pictures, objects and warnings.
- [Xlsx to markdown](/tools/xlsx-to-markdown): convert excel workbook to markdown.
- [Xlsx to CSV](/tools/xlsx-to-csv): convert excel sheet to csv.
- [Xlsx inspect](/tools/xlsx-inspect): inspect excel workbook structure.
