{"uid":"cap_-JUxgi6DbNlOohjSCq7G6","slug":"html-entity-encoder-cefb43d6","name":"HTML Entity Encoder","description":"Encode text to HTML entities so it can be safely embedded in markup. By default uses hex numeric references; set useNamedReferences for named entities (&amp;, &copy;) or encodeEverything to encode every character.","url":"https://html.openverbs.com/v1/encode","method":"POST","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method","bodyType","body"],"properties":{"body":{"type":"object","required":["text"],"properties":{"text":{"type":"string","maxLength":200000,"description":"Plain text to encode."},"encodeEverything":{"type":"boolean","description":"Encode every character, not just unsafe ones. Default false."},"useNamedReferences":{"type":"boolean","description":"Use named entities where available. Default false."}},"additionalProperties":false},"type":{"type":"string","const":"http"},"method":{"enum":["POST"],"type":"string"},"bodyType":{"enum":["json","form-data","text"],"type":"string"}},"additionalProperties":false}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.002","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.002/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_G5j1dG-gaZtblXS1-vn1Y","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.002","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Encodes plain text into HTML-safe entity references, supporting hex numeric (default), named entities, or full character encoding.","exampleAgentPrompt":"Encode this user-submitted comment into HTML entities so it's safe to embed in the page markup — use named references like &amp; and &copy; where available: 'Hello <World> & \"friends\" © 2024'","exampleUseCases":[{"title":"Escaping user input for HTML output","prompt":"I need to safely embed this user-submitted bio into my HTML page — encode all the special characters as hex HTML entity references: 'My name is <Jane> & I love \"coding\" and math: 2 < 3 > 1'."},{"title":"Encoding with named HTML entities for readability","prompt":"Encode this text using named HTML entities wherever possible, like &amp; and &lt;, so it's human-readable in the source: 'Copyright © 2024 Acme Corp — All rights & trademarks reserved <trademark>'."},{"title":"Full character encoding for maximum safety","prompt":"Encode every single character in this string as HTML entities — not just the unsafe ones — so nothing passes through unescaped: 'Hello World! <script>alert(1)</script>'."}],"resultDescription":"Returns the input text with special and/or all characters replaced by their HTML entity equivalents — hex numeric references by default (e.g. &#x3C; for <), named references if useNamedReferences is true (e.g. &lt;), or every character encoded if encodeEverything is true.","failureModes":["Input text exceeds 200,000 character limit — request rejected","Missing required 'text' field in body — validation error","Invalid bodyType value — request rejected","Network timeout for very large inputs","Payment failure via x402 protocol — request not processed"],"whenToPreferThis":"Choose this endpoint when you need to encode plain text into HTML entity references before embedding it in HTML markup — especially to prevent XSS or display issues caused by characters like <, >, &, and quotes. Prefer it over manual string replacement or sanitization endpoints when your input is already plain text (not HTML), and you want precise control over encoding style (hex numeric vs. named entities vs. encoding everything).","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T18:41:21.274Z","isFirstParty":false}