Paste the markup and choose C# or JSP: each input line becomes one statement, and quotes, backslashes and braces are escaped so the fragment reproduces the text you pasted.
Runs locally in your browserPaste HTML and press Html to C# code or Html to JSP code. The C# branch returns a StringBuilder with one statement per input line; the JSP branch returns the same lines as out.println and out.print calls inside a <% %> block. Both writers treat the input as text: nothing is parsed as HTML, no entity is decoded and nothing is executed.
The conversion runs in the browser and keeps working offline. The result is a fragment for a project you already have, where the C# StringBuilder or the JSP out object is in scope.
The C# writer starts with StringBuilder sb = new StringBuilder(); and then writes one statement per input line: sb.AppendLine("...") for a line that is followed by a line break, and sb.Append("...") for a final line that was not. AppendLine adds the line terminator of the platform the fragment runs on, which is what a response writer normally wants.
The JSP writer wraps the same line-by-line structure in <% and %>: out.println("...") for lines followed by a line break, and out.print("...") for a last line without one, so the JSP file reproduces the pasted text line for line. Empty input produces an empty <% %> block, and the C# branch returns only the StringBuilder declaration.
Inside the literals a backslash becomes \\, a double quote becomes \", a tab becomes \t and control characters are written as \uXXXX escapes, so one pasted line always stays one line of generated code. Apostrophes and braces are passed through unchanged: the C# writer appends with Append and AppendLine rather than AppendFormat, so a CSS rule or a JSON body full of { and } cannot be mistaken for a format placeholder and cannot raise a FormatException when the fragment runs.
The text box normalises line endings, so CRLF and CR input reaches the writer as LF. A trailing line break in the input is kept as a trailing AppendLine or println instead of being trimmed away, and an empty last line stays as an empty statement.
It does not parse or repair the markup, does not decode entities such as &, and does not check that the generated fragment compiles. It adds no class, namespace, imports or write call, and it cannot tell whether the HTML you pasted is complete or well formed.
This page converts to C# and JSP only; the ASP, VB.NET, Perl and SWS writers live on the page that turns HTML into ASP, VB.NET, Perl or SWS statements. The result pane stays hidden until one of the two buttons is pressed, and Copy on an empty result shows “Copy failed. Please copy manually.”