input,
textarea,
[contenteditable] {
    caret-color: red;
}
CSS Live Demo: caret-color Click the demo button below!
selector {
    caret-color: auto | <color>;
}
/* Keyword values */
caret-color: auto;
caret-color: transparent;
caret-color: currentcolor; /* The current text color of the element */

/* Color values */
caret-color: red;
caret-color: #00a0e9;
caret-color: rgb(0 200 0);
caret-color: hsl(228deg 6% 24% / 0.89);

/* Global values */
caret-color: inherit;
caret-color: initial;
caret-color: unset;
caret-color: revert;
caret-color: revert-layer;
<input type="text" id="custom-caret-input" placeholder="Type something...">
/* Input field styling */
#custom-caret-input {
    font-size: 16px;
    padding: 10px;
    border: 2px solid #333;
    border-radius: 5px;
    caret-color: red; /* Set the caret (cursor) color */
}
Live Example Preview To see the caret color, type text into the input box.
The caret color is red.