Improves how YouTube subtitles look and behave with smarter line wrapping, better readability, optional per-line background boxes, and cleaner handling of translator notes.
tampermonkey.user.js- Tampermonkey userscript versionenhancer-for-youtube.js- script version for Enhancer for YouTube
- Changes subtitle text color
- Changes subtitle size in normal mode and fullscreen mode
- Lets Tampermonkey users save subtitle size preferences through the userscript menu
- Can automatically keep YouTube's default subtitle size in previews, mini player, and other small player contexts
- Adjusts subtitle background color and opacity
- Supports one shared background box or per-line background boxes
- Keeps subtitles centered
- Lets you move subtitles higher on the screen
- Adds text shadow for better readability
- Wraps long lines automatically
- Tries to keep line breaks more natural and balanced
- Prefers two-line subtitles when possible
- Allows three lines only when needed
- Keeps translator notes in square brackets together
- Preserves a two-line layout when a translator note is already on its own line
textColor- subtitle text colorbackgroundColor- subtitle background color as RGB valuesbackgroundOpacity- background transparency from0to1fontSizeNormal- subtitle size in normal modefontSizeFullscreen- subtitle size in fullscreen modesubtitleSizeMode-default,script, orcustomsubtitle size modepreferYouTubeSizeInSmallPlayers- keeps previews and mini players on YouTube's default subtitle sizecustomFontSizeNormal/customFontSizeFullscreen- saved subtitle sizes for custom modelineHeight- spacing between subtitle linesmaxWidthPercent- maximum subtitle width relative to the video widthenableAutoLineBreaks- turns smart wrapping on or offpreserveAutoGeneratedCaptions- keeps YouTube auto-generated captions stable by not rewriting their textmaxCharsPerLine- target line length for smart wrappingperLineBackground- separate background per line or one shared boxpaddingY/paddingX- inner spacing inside the background boxborderRadius- roundness of subtitle background cornersoffsetNormal/offsetFullscreen- subtitle height from the bottomextraPerLine- extra upward offset for multi-line subtitlestextShadow- subtitle text shadow
lineHeight: 1.20,
maxWidthPercent: 78,
enableAutoLineBreaks: true,
preserveAutoGeneratedCaptions: true,
maxCharsPerLine: 44,
perLineBackground: true,- Install the Tampermonkey browser extension.
- Create a new script.
- Replace the template with the contents of
tampermonkey.user.js. - Save and open any YouTube video.
- Optional: use the Tampermonkey menu to switch between YouTube default subtitle size, the script's subtitle size, or your own saved custom size.
- Optional: keep YouTube's default subtitle size in previews and mini player while still using your preferred size in normal and fullscreen playback.
- Open Enhancer for YouTube settings.
- Find the custom script section.
- Paste in the contents of
enhancer-for-youtube.js. - Save and reload YouTube.
- This script only changes how subtitles are displayed.
- It does not modify the subtitle file itself.
- Final behavior can still depend on how YouTube renders captions internally.
- Best results usually come from adjusting
maxWidthPercent,maxCharsPerLine, andlineHeighttogether.
- Reduced the brief unformatted subtitle flash by running subtitle processing immediately on caption DOM changes, then keeping the existing animation-frame pass.
- Hid YouTube's temporary
English / Click for settingscaption info overlay when subtitles are toggled on.
- Only small bug fixes
- Fixed the
YT Sub Fixbutton appearing in live chat, embedded YouTube players, and Google preview windows. - Improved subtitle positioning so captions are placed correctly earlier, reducing the bottom-position flicker before the script-applied offset appears.
- Added a background mode switch in the settings panel.
Line BGuses a separate black background behind each subtitle line.Box BGuses one shared black background box behind the whole subtitle.- Improved per-line background rendering so multi-line subtitles look closer to YouTube's original style.
- Removed rounded corners from per-line subtitle backgrounds to avoid small gaps between stacked lines.
- Improved the settings panel layout so the background color, opacity, and background mode controls are easier to use.
- Fixed the ON/OFF switch so turning the script off restores YouTube's original subtitle styling more cleanly.
- Added YouTube header button: YT Sub Fix
- Added in-page settings panel
- Added text color picker
- Added background color picker
- Added background opacity slider
- Added subtitle size mode controls
- Added normal and fullscreen custom size controls
- Added subtitle position controls
- Added smart line wrapping controls
- Added visible line length value on wrapping buttons
- Removed Tampermonkey dropdown menu commands so only the script name appears
- Settings are saved automatically
The Line shorter and Line longer settings are saved immediately, but YouTube does not always refresh the visible subtitle layout in normal view right away. If the subtitle line wrapping does not visibly update while the video is playing, press F to switch between normal and fullscreen mode. This usually forces YouTube to redraw the subtitle layer, so the updated line wrapping becomes visible immediately.
- Added saved Tampermonkey subtitle size settings.
- Added subtitle size modes: YouTube default, script size, and custom size.
- Added automatic YouTube default sizing for previews, mini player, and small player contexts.
- Updated README with the new size settings.
- Improved subtitle centering so captions are centered immediately when rendered.
- Preserved auto-generated captions to avoid flickering and layout glitches.
