araç köşesi

HTML Entity Encoder and Decoder

Escape text into HTML entities, or turn entities back into the characters they stand for

Your data stays with you. Conversion happens inside the browser; nothing is sent to a server.

How it works

Paste your text into the left box; the result appears in the right box as you type. Encoding rewrites the characters that would otherwise break the HTML source: a product line reading "Gin & Tonic" becomes "Gin & Tonic" in the source and still shows an ampersand on the page. The scope decides how far this goes — the required five covers the characters that break structure and keeps the text readable, every non-ASCII character covers accents through symbols and is the safe choice when you cannot control the page encoding, and the punctuation scope targets the curly quotes and dashes that word processors insert. Decoding runs the other way and understands all three notations: named (& ü  ), decimal (ü) and hexadecimal (ü). On the named side every entity defined in HTML is decoded, accented forms such as ç and ñ and the mathematical signs included. An entity that is not recognised is never deleted; it is left exactly as it was and the status line counts it, so you keep the data and know which part needs a manual look. This tool does not touch tags — if you want to strip markup and keep the words, use the Convert HTML to Plain Text tool instead. Copy the output with one click or download it as a text file.

This tool is also known as html entity encoder, html entity decoder, escape html characters, encode special characters for html, html entities converter.

What is HTML entity?

An HTML entity is a way of writing a character indirectly in the source: it starts with an ampersand, ends with a semicolon and carries either a name (ü) or a number (ü) in between. Two reasons keep entities alive. The first is necessity — a less-than sign is read as the start of a tag, so text that needs to display one has to write < instead. The second is convenience: a character that is missing from the keyboard or unreliable in an unknown encoding (€, —, ½) travels safely as an entity. Entities exist only in the source; by the time the browser paints the page they are ordinary characters again.

What is   (non-breaking space)?

The name is short for non-breaking space, and it differs from an ordinary space in two ways. It does not break: write '5 kg' with   and the number will never be left at the end of one line with the unit on the next, which is why it is used between figures and units, names and titles, dates and months. And it is not collapsed: HTML reduces runs of ordinary spaces to a single space, whereas every   is preserved, which is how old pages built indentation. As a character it sits at position 160 in Unicode and is invisible when pasted into text — a frequent and baffling cause of alignment problems in copied content.

What is Escaping?

Escaping means writing a character that carries special meaning in its context so that the system reads it as data instead of syntax. Each context has its own rule: in HTML the less-than sign becomes <, in a URL a space becomes %20, in SQL a single quote is doubled. The shared logic is the same everywhere — without escaping, the system believes the text has ended and treats the rest as part of the structure. In HTML the consequences run from a broken layout to user-supplied text turning into a working tag, which is why anything arriving from outside is escaped before it is placed into a page.

How do HTML escaping, tag stripping and URL encoding differ?

All three transform text, but each applies the rules of a different context and none can stand in for another. The escaping on this page works at character level: the wording stays identical, and only the marks that carry special meaning in HTML source are rewritten, so the text appears as words rather than as markup. The Convert HTML to Plain Text tool goes the other way and works at structure level: it discards tags, script and style blocks and leaves the readable text — its input is HTML and its output is plain text. The URL Encoder and Decoder belongs to a different context altogether: it rewrites characters that an address cannot carry using a percent sign and two hexadecimal digits, so a space becomes %20. HTML escaping will not make an address valid, and percent-encoding will not make a string safe to embed in a page. The short rule: embedding text in a page, use this tool; pulling text out of a page, use tag stripping; building an address, use percent-encoding.

Which scope should you pick?

Scope only affects encoding; when decoding, every entity is recognised regardless of the setting. Choose according to where the output is going:

  • Putting user-supplied text into an HTML page → the required five (structure is protected, readability is untouched)
  • An old email template or a CMS field whose character encoding you cannot verify → every non-ASCII character
  • A modern UTF-8 page you control → the required five is enough; encoding accents only inflates the file
  • Text pasted from Word that shows question marks or black diamonds → typographic punctuation
  • Writing XML rather than HTML: only five named entities exist there, so named forms like ü will not resolve — use the numeric scope

Named or numeric?

Every character has two entity notations: named (ü) and numeric (ü or ü). The numeric form exists for every character and resolves everywhere; the named form is readable but only exists for the characters on the list, and which standard defines that list matters.

When encoding, this tool uses a named form only where the name has existed since HTML 4, and writes everything else numerically. Curly quotes and dashes come out named (“ ” — …) because those names are old and universally supported, while characters whose names arrived with HTML5 are written numerically so that an old email client still renders them.

Decoding is deliberately wider: 254 named entities are recognised, including the four HTML5 names for Turkish letters (Ğ ğ Ş ş), because you do not choose the text that lands in front of you. All decimal and hexadecimal references are decoded as well.

The Word paste trap: “

HTML that comes out of older desktop software and some content systems contains numeric entities in the 128-159 range: “, —, ’. In Unicode that range is reserved for invisible control characters, so decoded literally it produces nothing at all, or a row of black diamonds.

What was actually meant are the typographic marks of the Windows-1252 character set: “ is a left double quotation mark, ” a right one, — an em dash, ’ an apostrophe. Browsers quietly apply this mapping; so does this tool. Decode an archived page and your quotation marks and dashes come back as real punctuation instead of disappearing.

Double encoding: escaping the same text twice

The classic escaping mistake is encoding a string twice. An ampersand becomes & on the first pass; on the second pass the ampersand inside that entity is encoded too and you get &. The page now shows the letters & rather than an ampersand.

It usually happens in this order: a form value is escaped as it is saved, then the template engine escapes the output again. The symptom is recognisable — visitors see   or ç printed on the page. The fix is equally simple: decode the text once here; if entities are still left in the output, the text was encoded twice and the second escaping step in your pipeline has to go.

Frequently asked questions

What is   and how does it differ from a normal space?

  is a non-breaking space. It is as wide as a normal space, but the browser will not break the line at that point, and consecutive non-breaking spaces are not collapsed into one. It is used between a number and its unit ('15 kg'), in names and dates that should stay together, and wherever several visible spaces are needed.

Do I have to encode accented letters?

Not if your page is UTF-8 — you can write them directly and the file stays smaller. Encoding earns its keep where you cannot control the character set: legacy email templates, admin panels with a fixed encoding and export fields that only accept ASCII.

Does this tool remove HTML tags?

No. Escaping works at character level: encoding turns the angle brackets of a tag into entities, so the tag becomes visible text, while decoding leaves tags exactly as they are. To strip markup from a source and keep only the words, use the Convert HTML to Plain Text tool.

What happens to an entity the tool does not recognise?

It is left untouched and counted in the status line. That is deliberate: deleting an unknown sequence would silently remove part of your text, and replacing it would mean inventing a character that may be wrong.

Is the text I paste sent to a server?

No. Encoding and decoding run entirely inside your browser, so customer correspondence, order notes or unpublished page copy never leave this page and are not stored anywhere.