CSS caret-color Property

Beginner
4 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The caret-color property sets the color of the insertion caret — the blinking marker that shows where the next character will be typed or deleted.

It applies to focused editable text: text-like <input> types, <textarea>, and contenteditable elements. It is inherited. The initial value is auto, which usually matches the text color (currentColor).

Not the mouse cursor.

caret-color is only the text insertion caret. The mouse pointer is controlled by cursor.

CSS Syntax

syntax.css
caret-color: auto | <color> | initial | inherit;

Any valid CSS color works: named colors, hex, rgb(), hsl(), transparent, or currentColor.

Property Values

ValueDescriptionTry it
autoDefault. Usually the current text colorTry it
<color>Any color, such as red, #2563eb, or rgb(0 200 0)Try it
transparentHides the caret (use carefully)Try it
currentColorMatches the element’s color valueTry it
initialResets to autoTry it
inheritTakes the parent’s caret-colorTry it

How to Use caret-color

Pick an editable field, then set a caret color that stays visible against the background.

  1. Target an editable control (input, textarea, or contenteditable).
  2. Choose auto for the default, or any <color> for a custom caret.
  3. Click or tab into the field to focus it — the caret only shows when focused.
  4. Check contrast so the caret remains easy to see.
PieceRequired?Role
Editable elementYesText input, textarea, or contenteditable
FocusYes (to see it)The caret appears only while the field is focused
caret-color valueYesauto or any CSS color

Live Preview

Focus the field and switch colors. The blinking caret updates live.

Click the field so it is focused. You should see the caret blink in the chosen color.

Input

caret-color: red

CSS Examples

Each snippet focuses on caret-color. Focus the field in the editor to see the caret. Use Try It Yourself for a live editor.

Example 1 — Custom Caret Color

Give a text input a red insertion caret.

CSS
<style>
  input {
    caret-color: red;
  }
</style>

<input type="text" value="Focus me">
Try It Yourself

How It Works

  1. Target the input. The rule applies to the text field.
  2. Set a color. caret-color: red paints the insertion caret red.
  3. Focus to see it. Click or tab into the field; the caret only appears when focused.
  4. Text color stays separate. Changing the caret does not change the typed text color.

Example 2 — Default Auto Caret

Let the browser match the caret to the text color.

CSS
<style>
  input {
    color: #0f766e;
    caret-color: auto;
  }
</style>

<input type="text" value="Auto caret">
Try It Yourself

How It Works

  1. Set text color. color styles the characters you type.
  2. Use auto. caret-color: auto usually follows that text color.
  3. Good default. Most forms can leave the caret on auto.
  4. Override when needed. Pick a custom color if the caret needs more contrast.

Example 3 — Textarea Caret

The same property works on multi-line fields.

CSS
<style>
  textarea {
    caret-color: #2563eb;
  }
</style>

<textarea rows="3">Focus me</textarea>
Try It Yourself

How It Works

  1. Target textarea. Multi-line fields use the same property.
  2. Set a hex color. #2563eb makes a blue caret.
  3. Focus the area. Click inside to see the caret blink.
  4. Same idea for contenteditable. Editable paragraphs accept caret-color too.

Edge Cases & Pitfalls

If you do not see a caret, one of these is usually why.

focus

Caret needs focus

The insertion caret only appears while the editable field is focused. Click or tab into the control.

cursor

Do not confuse with cursor

cursor styles the mouse pointer. caret-color styles the text insertion caret only.

input

Not every input type has a caret

Text, email, search, tel, and password show a caret. Checkbox, radio, color, and date inputs generally do not.

a11y

transparent can hurt usability

Hiding the caret makes typing harder. Keep enough contrast against the field background.

animate

Animating from auto is discrete

Transitions from auto to a color do not interpolate smoothly; the change snaps at the midpoint.

Browser Support

caret-color is a browser UI property for editable text. Node.js, Deno, and Bun do not apply it.

✓ Baseline · Widely available

caret-color

Chrome 57+, Firefox 53+, Safari 11.1+, Edge 79+, Opera 44+. Widely available since January 2020.

98% Modern browsers
Google Chrome 57+
Full
Mozilla Firefox 53+
Full
Apple Safari 11.1+
Full
Microsoft Edge 79+
Full
Opera 44+
Full
Samsung Internet 7.0+
Full
Internet Explorer No
None
caret-color Widely supported

Bottom line: Safe for modern browsers. Pair with a visible text color and enough contrast so the caret stays easy to find.

Key Takeaways

  • Role: color the blinking text insertion caret in editable fields.
  • Common values: auto and any CSS <color>.
  • Initial value: auto. Inherited. Needs focus to appear.
  • Not cursor: mouse pointer styling belongs to cursor, not caret-color.

One line: caret-color paints the blinking insertion caret — focus the field to see it.

Frequently Asked Questions

It sets the color of the insertion caret — the blinking text cursor — in focused editable fields such as text inputs, textareas, and contenteditable elements.
The initial value is auto. Browsers typically resolve that to the current text color (currentColor).
caret-color styles the blinking insertion point inside editable text. The cursor property styles the mouse pointer when you hover over an element.
It applies to text inputs (text, email, search, tel, password), textarea, and contenteditable elements. Date, checkbox, radio, and color inputs do not show a text caret.
Yes. caret-color: transparent hides the caret. Use that carefully — users often need a visible insertion point.
It is Baseline and widely available: Chrome 57+, Firefox 53+, Safari 11.1+, Edge 79+. It is a browser UI property, not a Node.js feature.

Next: clear

Learn how to clear floats so content starts below floated elements.

clear tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful