thinQmaster Virtual testing partner Adaptive practice exams that find your weak spots and drill them. Every answer explained. From $69
Enroll

thinQmaster

Find your exam

Five questions free, before you decide.

Step 1 · choose a vendor

In one of our camps? Your practice exams come with the tuition — they are on your study page already.

Application & OT Security · Foundational

Output Encoding

Converting untrusted data into a safe representation for the specific context where it is output, such as HTML, JavaScript, URL or SQL.

Definition

Context matters: HTML entity encoding protects HTML body content but not JavaScript or URL contexts. Encoding at output time is the primary defense against cross-site scripting, while frameworks with auto-escaping templates apply it by default.

Example

A comment containing <b> is rendered as &lt;b&gt; so the browser displays it rather than executing markup.

Exam tip

XSS is prevented mainly by context-aware output encoding, not input filtering.

Don't confuse it with

Related terms