Replace the var keyword with let or const across your code, string, comment and regex aware so text like \. var to let / const is a free online tool from the ToolsRift JavaScript Tools collection. It runs entirely in your browser — nothing to install, no signup, and your data never leaves your device.
Paste your code, choose let or const as the replacement, then click Convert. Every var declaration keyword is replaced and the count is reported.
No. The converter tracks string, comment and regex literals, so only the actual var keyword is replaced — text like "var" inside a string stays intact.
let is the safe default for variables that are reassigned. const is stricter; only pick it if you know none of the declarations are reassigned later.
No. Replacement is whole-word only, so identifiers that merely contain the letters var, such as variable or avar, are left unchanged.