# HTML Email to Text

Convert HTML email to readable plain text: strip tags, keep paragraphs and lists, render links inline or as footnotes, and optionally wrap lines.

## Run it

- **CLI:** `gizza tool html-email-to-text '<h1>Weekly update</h1><p>Read the <a href="https://example.com/post">latest post</a>.</p>'`
- **Web:** https://gizza.ai/tools/html-email-to-text/
- **Agents:** machine-readable descriptor (parameters JSON Schema) at https://gizza.ai/tools/html-email-to-text/tool.json

## Inputs

- `html` — HTML email body _(field)_
- `links` — Links _(field)_
- `wrap` — Wrap width (columns, 0 = off) _(field)_

## Output

- Plain text (text)

## Query parameters

Open the tool pre-filled and auto-run via URL:

- `html` — HTML email body
- `links` — Links
- `wrap` — Wrap width (columns, 0 = off)

Example: `https://gizza.ai/tools/html-email-to-text/?html=%3Ch1%3EWeekly%20update%3C%2Fh1%3E%3Cp%3ERead%20the%20%3Ca%20href%3D%22https%3A%2F%2Fexample.com%2Fpost%22%3Elatest%20post%3C%2Fa%3E.%3C%2Fp%3E&links=inline&wrap=72`

---

## About this tool

Marketing and transactional emails are usually sent as HTML, but you often need the
**plain-text version** — the `text/plain` alternative part that non-HTML clients show, the
copy you paste into a ticket, or a clean read of a newsletter without the layout. This tool
takes an **HTML email body** (the whole `<html>` document or just a `<body>` fragment) and
returns readable plain text: tags removed, HTML entities like `&amp;` and `&nbsp;` decoded,
and paragraphs, headings, and list items kept on their own lines.

The email-specific part is how it treats **links** and **line width**:

- **Links — Inline** (default): `<a href="https://example.com">click here</a>` becomes
  `click here (https://example.com)`, so the destination survives in plain text.
- **Links — Footnotes:** each link is numbered inline (`click here[1]`) and the URLs are
  collected into a `[1] https://example.com` reference block at the bottom — tidy for
  link-heavy newsletters.
- **Links — Text only:** keeps just the visible link text and drops the URL.
- **Wrap width:** set a column count (72 is the classic plain-text-email width) to hard-wrap
  long paragraphs on word boundaries. URLs and other long tokens are never split. Leave it at
  `0` for unwrapped output.

`mailto:` and `tel:` links are shown without the scheme (`email us (hi@example.com)`), and
in-page `#anchors`, `javascript:`, and `data:` links are dropped as noise.

### Worked example

Input (`links` = Footnotes):

```html
<p>See the <a href="https://example.com/docs">docs</a> and
<a href="https://example.com/pricing">pricing</a>.</p>
```

Output:

```
See the docs[1] and pricing[2].

[1] https://example.com/docs
[2] https://example.com/pricing
```

Everything runs locally in your browser via WebAssembly — the email content is never
uploaded, so it is safe to paste sensitive messages.

## FAQ

<details>
<summary>What's the difference between this and a plain "HTML to text" stripper?</summary>

A bare stripper just removes tags and usually discards link URLs. This tool is aimed at
emails: it keeps hyperlink destinations (inline or as numbered footnotes), can hard-wrap to
the classic 72-column plain-text-email width, strips `mailto:`/`tel:` schemes, and drops
in-page/`javascript:` links that add no value in plain text.

</details>

<details>
<summary>Should I paste the full HTML email or just the body?</summary>

Either works. You can paste the entire `<html>…</html>` source (for example the "view
source" of a message) or just the inner `<body>` fragment. Surrounding `<head>`, `<style>`,
and `<script>` content is ignored and does not appear in the output.

</details>

<details>
<summary>How are links rendered?</summary>

Choose one of three modes. **Inline** (the default) writes the link text followed by the URL
in parentheses. **Footnotes** numbers each link (`text[1]`) and lists the URLs at the bottom.
**Text only** keeps the visible text and drops the URL. When the visible text already *is* the
URL or email address, it is not duplicated.

</details>

<details>
<summary>Why would I wrap at 72 columns?</summary>

Plain-text email convention wraps body lines at around 72 columns so the message reads well in
terminals and quotes cleanly in replies. Set the wrap slider to 72 (or 78) to get that; set it
to 0 to leave lines unwrapped for on-screen reading. Long words such as URLs are never broken,
even if they exceed the wrap width.

</details>

<details>
<summary>Are images, tables, and buttons preserved?</summary>

Images are dropped (plain text has no images), and their `alt` text is not currently emitted.
Tables and button-styled links are flattened to their text content — a button that links
somewhere is treated like any other link. If you need the visual layout, keep the HTML
version; this tool produces a text reading of the content.

</details>

## Limits & notes

- Output is plain text only — no Markdown markers (`#`, `**`, `-`) are added.
- Image `alt` text and CID/attachment images are not included.
- The wrap width accepts 0–200 columns; 0 disables wrapping.
- Runs fully in-browser; nothing is uploaded.

## Related tools

- [Basic Auth Header Generator](https://gizza.ai/tools/basic-auth-header-generator/): Generate an HTTP Basic Authorization header from a username and password — base64(user:pass) per RFC 7617. Runs in your browser, nothing is sent, free.
- [CIDR Calculator](https://gizza.ai/tools/cidr-calculator/): CIDR calculator: get network address, broadcast, netmask, wildcard, usable host range and host count for any IPv4 or IPv6 prefix. Free, private, in-browser.
- [cURL Command Parser](https://gizza.ai/tools/curl-command-parser/): Paste a curl command to see its method, URL, query params, headers, body, auth, cookies and flags — or rebuild clean curl. Browser-only.
- [Disposable Email Detector](https://gizza.ai/tools/disposable-email-detector/): Check if an email address or domain is a disposable or throwaway inbox (Mailinator, Guerrilla Mail, YOPmail and more) — free, private, right in your browser.
- [DNS Message Parser](https://gizza.ai/tools/dns-message-parser/): Decode a DNS wire-format message from hex or base64url — header flags, RCODE, question and answer records, name decompression. Free, in your browser.
