# Sanitizing vs. Validating

> What is the difference between input validation and input sanitization, and when should you use each?

Canonical: https://www.internhack.in/learn/interview/web-security/security-sanitizing-inputs
Last updated: 2026-11-28

Difficulty: Beginner

## Question

What is the difference between input validation and input sanitization, and when should you use each?

*The full answer is for InternHack members. Open the page link above to read it.*

## Concepts covered

Input Validation, Sanitization, Output Encoding, Allowlist, Schema Validation

Previous: [Clickjacking](https://www.internhack.in/learn/interview/web-security/security-clickjacking-protection) · Next: [Broken Access Control](https://www.internhack.in/learn/interview/web-security/security-broken-access-control) · [All of Web Security (OWASP, JWT, XSS, CSRF)](https://www.internhack.in/learn/interview/web-security)

## More Web Security (OWASP, JWT, XSS, CSRF) questions

- [Password Complexity](https://www.internhack.in/learn/interview/web-security/security-password-complexity)
- [DoS vs. DDoS](https://www.internhack.in/learn/interview/web-security/security-dos-vs-ddos)
- [Man-in-the-Middle (MITM)](https://www.internhack.in/learn/interview/web-security/security-man-in-the-middle)
- [Homograph Attack](https://www.internhack.in/learn/interview/web-security/security-homograph-attack)
- [The Purpose of Salt](https://www.internhack.in/learn/interview/web-security/security-salting-passwords)
- [Pepper vs. Salt](https://www.internhack.in/learn/interview/web-security/security-peppering-passwords)

## Related

- [Learn](https://www.internhack.in/learn)
- [Interview Prep](https://www.internhack.in/learn/interview)
- [Web Security (OWASP, JWT, XSS, CSRF)](https://www.internhack.in/learn/interview/web-security)
