What is a Rabin Karp Visualizer?
A Rabin Karp visualizer shows how rolling hashes can find candidate pattern matches inside a text string. Instead of comparing every character at every shift first, Rabin-Karp compares a pattern hash with the current window hash, then verifies characters when the hashes match.
This tool lets you enter text and a pattern, adjust the hash base and modulus, then step through hash checks, rolling updates, possible collisions, and confirmed match indexes.
For related pattern-matching and string dynamic-programming tools, browse the String Algorithm Visualizers hub.
How to use this Rabin Karp visualizer
- Enter the text to scan.
- Enter the pattern to search for.
- Adjust the base and modulus if you want a different rolling hash.
- Click Run Rabin Karp to jump to the completed match list.
- Step forward to watch the current window hash, pattern hash, rolling update, and match verification.
Rabin-Karp vs KMP
Rabin-Karp uses hashing to filter candidate windows. KMP uses the LPS table to avoid moving the text pointer backward after a mismatch. Both are useful string matching algorithms, but they explain different ideas.
Compare this page with the KMP String Matching Visualizer and Z Algorithm Visualizer to see prefix-based matching without rolling hashes.