String & Code Converter
Paste HTML and convert it to C# strings, JavaScript, JSON, Base64 and more
When Do You Need String Conversion?
Embedding HTML inside C# or JavaScript means escaping quotes, backslashes and line breaks according to each language’s string rules. Getting this wrong produces compile errors or corrupted output. This tool handles the escaping automatically so you can paste raw markup and get valid code back.
Supported Conversions
- C# String / Verbatim / Raw
- Standard escaped strings (
\"), verbatim strings (@""where quotes are doubled) and C# 11 raw string literals (""") which need no escaping at all. - JavaScript / Template Literal
- Single-line concatenated strings or ES6 backtick template literals that preserve line breaks natively.
- JSON String
- A JSON-safe value with all special characters escaped per RFC 8259. Useful when constructing API request bodies.
- URL Encode / Base64
- Percent-encoding for query parameters and Base64 for embedding binary content in data URIs or tokens.
- HTML Encode / Decode
- Converts
<,>,&and quotes to their HTML entities and back. Essential when displaying user input inside a web page without triggering XSS. - Prettify / Minify JSON
- Formats compact JSON with indentation for readability, or strips whitespace to reduce payload size.
How It Works
Paste your source text on the left, select a conversion mode and the output appears instantly on the right. Everything runs client-side in the browser. Nothing is sent to a server and your input is never stored. Use the sample buttons to try each mode with realistic test data.