SQLite 3 reference · String Functions

SQLite REPLACE() Function

Replace every occurrence of one string with another inside a string. The search is case-sensitive.

SQLite 3

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

replace(X, Y, Z)

Parameters

ParameterDescription
X The original string.
Y The text to find.
Z The replacement.

Return value

The new string.

Examples

Replace textTry it yourself
SELECT replace('2026-01-05', '-', '/') AS us_style,
       replace('tea and cake', 'and', '&') AS short;

Output

us_style | short
2026/01/05 | tea & cake
Make URL slugsTry it yourself
SELECT name, replace(lower(name), ' ', '-') AS slug
FROM products
LIMIT 3;

Output

name | slug
SQL for Beginners | sql-for-beginners
Clean Code | clean-code
The Pragmatic Programmer | the-pragmatic-programmer

In other languages

Was this page helpful?