Utvikling · verktøy

HTML-entitetskoder og -dekoder

Lim inn tekst, velg retning og konverter HTML-spesialtegn umiddelbart.

Kjøres i nettleseren. Ingen opplasting.

Runs only in your browser.

Om verktøyet

HTML-entitetskoder og -dekoder sem complicação.

Nyttig for å skrive sikre HTML-utdrag, feilsøke kodet tekst og kontrollere entiteter uten å sende innholdet til en server.

Veiledning

Slik bruker du HTML-entitetskoder og -dekoder

This tool converts text to HTML entities and back. Encode HTML swaps the five characters that have a special meaning in HTML, which are the ampersand, the two angle brackets and the two kinds of quote mark, for their entity codes so they show up as plain text. Decode HTML turns entities such as & or é back into readable characters. It does not check or clean HTML for safety.

Slik gjør du

  1. Pick Encode HTML to turn special characters into entities, or Decode HTML to turn entities back into characters. Encode is selected when the page opens.
  2. Paste or type your text into the Text to convert box.
  3. Press Convert. The converted text appears in the Result box. Changing the direction does not convert anything by itself, so press Convert again after you switch.
  4. Press Copy result to copy the output, or Clear to empty both boxes.

Eksempler

Encoding a snippet

Du skriver inn
Retning
Encode HTML
Tekst
<p class="intro">Tom & Jerry's café</p>
Du får
Resultat
<p>Tom & Jerry's café</p>

The brackets, both quote marks and the ampersand are replaced. The letter é is left as it is, because Encode only touches those five characters.

Kjørt med verktøyets egen kode.

Decoding entities

Du skriver inn
Retning
Decode HTML
Tekst
&lt;p&gt;Tom &amp; Jerry&#39;s caf&eacute;&lt;/p&gt;
Du får
Resultat
<p>Tom & Jerry's café</p>

Named entities such as &eacute; and numeric ones such as &#39; both become their characters. The tags in the result are plain text, not live HTML.

Kjørt med verktøyets egen kode.

A query string that changes

Du skriver inn
Retning
Decode HTML
Tekst
page?a=1&not=3
Du får
Resultat
page?a=1¬=3

The browser reads &not without a semicolon as an old entity name and turns it into a not sign. Text with a bare ampersand before letters like these can change when you decode it.

Kjørt med verktøyets egen kode.

Text that was encoded twice

Du skriver inn
Retning
Decode HTML
Tekst
&amp;lt;
Du får
Resultat
&lt;

Each press of Convert undoes one layer. Press Convert on the result again to get the final < character.

Kjørt med verktøyets egen kode.

Når det er nyttig

  • Show a code sample such as a div tag inside a web page or blog post without the browser treating it as real markup.
  • Read text that arrives full of &amp; and &quot; from an export, a feed or an old database.
  • Repair a string that was encoded twice by decoding it one layer at a time.
  • Preview how a snippet looks once encoded before you paste it into a template.

Begrensninger

  • Encode changes only five characters: ampersand, less-than, greater-than, double quote and single quote (written as &#39;). Accented letters, the euro sign and other non-ASCII characters stay as they are.
  • Decode uses the browser's own HTML reader. It knows named, decimal and hexadecimal entities and some old names that work without a semicolon, so text that only looks like an entity can change.
  • One pass at a time: &amp;lt; becomes &lt; and not <. Convert again for text that was encoded twice.
  • Escaping text for display is only one step. It does not make untrusted content safe in every place, for example inside a script or a web address.

Tips

  • Encode only once. Text that already contains &amp; becomes &amp;amp;, which then shows the wrong characters on the page.
  • When you decode a web address or query string, read the result closely, because pieces such as &not or &copy can change by themselves.
  • Both kinds of quote mark are encoded, so the result can also sit inside an HTML attribute value wrapped in either kind of quote.

Kilder

Vanlige spørsmål

Sobre HTML-entitetskoder og -dekoder.

Why encode HTML special characters?

Characters like < and & mean something to a browser. If you want them to appear as text, you write them as entities. Encoding stops a snippet such as a tag from being read as real markup.

Can I turn HTML entities back into text?

Yes. Choose Decode HTML, paste the entities and press Convert. Names such as &eacute;, decimal codes such as &#65; and hexadecimal codes such as &#x41; all become their characters.

Which characters does Encode change?

Five: the ampersand, the less-than and greater-than signs, the double quote and the single quote. Everything else, including letters with accents and symbols like the euro sign, is left exactly as you typed it.

Why did my text change when I decoded it?

The browser also accepts some older entity names without a semicolon. Text such as ?a=1&not=3 contains &not, which turns into a not sign. If the text is a web address, do not decode it, or encode its ampersands first.

What happens if I decode text twice?

Each decode removes one layer. &amp;lt; becomes &lt; after the first press and < after the second. Decode again only when you know the text was encoded more than once.

Does the tool run or clean my HTML?

No. In a test, tags in the decoded result stayed as plain text. The tool also does not remove scripts or check markup, so do not treat it as a safety filter for untrusted content.

Is my text sent anywhere?

No. The page states that the conversion runs only in your browser, and the text is not sent to a server, so you can paste private snippets.

Hvordan bruker du HTML-entitetskonverterer?

Lim inn tekst, velg retning og konverter HTML-spesialtegn umiddelbart.

Lastes dataene mine opp til en server?

Nei. Behandlingen skjer i nettleseren din, og opplysningene dine lastes ikke opp.