I recently reinstalled the OS on a friend's computer. While re-downloading the usual software, I realized just how ridiculously many ads Baidu shows—even with an ad-filtering userscript installed, keyword-targeted promotions still slip through.

Unofficial download link
These promotions occupy huge blocks; you have to scroll several times just to see the real results. Add to that extras like “related videos” and “hot sales across the web,” and you’ve got clutter that’s not just useless—it’s actively annoying. Fortunately, the ad-filter userscript I’d installed supports custom CSS, so I can hide those promotions outright. After a night of googling weird keywords, I ended up with the block list below; just paste it into the script’s custom-style box and save.
/* Updated 2024-08-27 */
/* Hide all useless Baidu services */
div[tpl*="game"],
div[tpl="pc-soft-accurate"],
div[tpl="pc-soft-fs"],
div[tpl="se_st_com_abstract"],
div[tpl="short_video_pc"],
div[tpl="se_st_single_video_zhanzhang"],
div[tpl="exactqa"],
div[tpl="yl-vd-basis"],
div[tpl="text04"],
div[tpl="b2b_industry_zk"],
div[tpl="sp_hot_sale"],
div[tpl="ads_b2c_universal_card"],
div[tpl="news-realtime"],
div[tpl="jy_course_and_org_pc"],
div[tpl="poi_mapdots"],
div[tpl="ms_weak_kefu"],
div[tpl="jr_stock"],
div[tpl="job3"],
div[tpl="zk-header"],
div[tpl="short_video"],
div[tpl="video_vast"],
div[tpl="med_disease_kg_collection"],
div[tpl="ask_doctor"],
div[tpl="med_qa"],
div[tpl="b2b_factory2"],
div[tpl="bjh_addressing"],
div[tpl="recommend_list"],
div[tpl="kaifa_pc_blog_weak"],
div[class*="video-container"],
div[tpl="vmp_zxenterprise_new"],
div[tpl="open_source_software"],
div[tpl="pc-soft-app"],
div[tpl="vmp_newproject_new"],
div[tpl="wenda_abstract_pc"],
div[tpl="aladdin_wenku_pc_new"] > div,
div[tql*="wenku"],
div[tpl="jr_stock_comment_san"],
div[tpl="ybb"],
div[tpl="med_disease_kg_collection_san"],
div[tpl="live_converge_san"],
div[tpl="sp_purc_pc"],
div[tpl="ins_application_card"],
div[tpl="generaltable"] {
margin: 0 0 10px !important;
padding: 10px 20px !important;
& > * {
display: none !important;
}
&::after {
content: "Matched rule:" attr(tpl);
color: #a9a9a9;
text-align: right;
width: 50%;
}
&::before {
content: "Result hidden";
width: 50%;
}
}
/* Hide certain Baidu components */
#wrapper #content_left .op-soft-title a:hover:after,
#wrapper #content_left .result a:hover:after,
#wrapper #content_left .result-op a:hover:after,
#wrapper #content_left > .c-container a:hover:after,
#wrapper #content_left .op-soft-title a:visited:hover:after,
#wrapper #content_left .result a:visited:hover:after,
#wrapper #content_left .result-op a:visited:hover:after,
#wrapper #content_left > .c-container a:visited:hover:after,
.pf,
.s-top-username,
.selected-search-box,
#searchTag,
.new-pmd .c-gap-top-xsmall,
.AC.sp-separator,
.s_tab,
#result_logo,
.toindex,
.soutu-btn,
.quickdelete-line,
.soutu-hover-tip,
div[class*="pc-source"],
div[class*="source_"],
.op-guide-cont,
.c-showurl,
.c-tools,
.bdsug-feedback-wrap,
.c-gap-top-mini,
div[class*="daoliu"],
.sc-card-footer,
div[class*="fy-star-box"],
div[class*="_bg-header_"],
div[class*="_new-kg-header_"],
div[tpl="app/hit-top-new"],
div[tpl="app/footer"],
div[tpl="app/rs"],
div[tpl="app/search-tool"],
div[class*="fy-dictwisenew-mnemonic"],
div[class*="video-wrap"],
div[class*="exam_"],
/* Hide celebrity-rank & gift modules in Baike */
.c-group-wrapper,
.search-source-wrap,
.ipt_rec,
.quickdelete,
div[class*="blog-more-wrap"],
h3::before,
div[class*="sourcebox_"],
/* AI summary styling tweaks */
div[tpl="wenda_index"] div[class*="interact-wrapper"],
/* Baike Wenku result styling tweaks */
div[tpl*="wenku_wenshu"] div[class*="footer"],
div[tpl*="wenku_wenshu"] a[class*="check-more"],
div[tpl="ms_mark"] div[class*="link-more_"],
div[tpl="ms_number"] div[class*="link-more_"],
div[class="cu-mt-sm-lg"],
span[class*="detail-btn_"] {
display: none !important;
}
/* Developer-search boxes special handling */
div[tpl*="kaifa_"] {
display: flex;
flex-direction: column;
overflow: hidden;
& > h3 {
width: 100%;
margin: 0;
}
}
/* Phone-number lookup */
div[tpl="ms_mark"],
div[tpl="ms_number"] {
& .new-pmd .c-gap-top-xsmall {
display: block !important;
}
}
/* Baike Wenku result styling tweaks */
div[tpl*="wenku_wenshu"] {
& div[class*="info-wrap-new"] {
opacity: 0;
}
}
/* Disease-related queries special reminder */
div[tpl="ask_doctor"],
div[tpl="wenda_abstract_pc"],
div[tpl="med_disease_kg_collection_san"] {
background-image: linear-gradient(to right, #ff758c 0%, #ff7eb3 100%);
display: -webkit-box !important;
display: -ms-flexbox !important;
display: flex !important;
-webkit-box-align: center !important;
-ms-flex-align: center !important;
align-items: center !important;
padding: 15px !important;
&::after {
font-size: 15px;
font-weight: bold;
color: #fff;
content: "Important: You are searching for medical information. Do not trust online results blindly—see a doctor promptly." !important;
display: block !important;
margin-right: auto !important;
margin-left: auto !important;
}
&::before {
content: "" !important;
}
}
/* Result-box tweaks */
#container {
margin-left: unset !important;
width: 100%;
}
/* Baike tweaks */
.cos-row .cos-col {
width: 15% !important;
}
.cu-border {
width: 100%;
padding: 0 0px 0px 20px !important;
}
.cu-border,
div[class*="re-box"],
table {
box-shadow: none !important;
width: 100%;
}
.result,
.result-op.c-container.new-pmd {
border: 2px solid rgba(0, 0, 0, 0.1) !important;
width: 100%;
box-shadow: none !important;
border-radius: 6px !important;
transition: border 0.15s ease-in-out;
}
#container.sam_newgrid .c-container .t a,
#container.sam_newgrid .c-container .c-title a {
text-decoration: none !important;
}
#wrapper #content_left .op-soft-title h3[class*="t"],
#wrapper #content_left .result h3[class*="t"],
#wrapper #content_left .result-op h3[class*="t"],
#wrapper #content_left > .c-container h3[class*="t"],
#wrapper #content_left > .c-container h3[class*="t"] {
background-color: #f8f8f8;
margin: 0px -8px 10px -20px;
padding: 8px 20px 5px;
border-radius: 5px 5px 0 0;
}
#wrapper #rs,
#wrapper #content_left .result,
#wrapper #content_left .result-op,
#wrapper #content_left > .c-container {
display: flex;
align-items: center;
& > div {
margin: 0 !important;
width: 100% !important;
}
/* Fallback for occasional single mismatches */
& > div > div {
margin: 0 !important;
width: 100% !important;
}
}
.result:hover,
.result-op.c-container.new-pmd:hover {
border: 2px solid rgb(0 186 145 / 60%) !important;
box-shadow: none !important;
border-radius: 6px !important;
transition: border 0.15s ease-in-out;
}
a[class*="foot-more"] {
margin-top: 8px;
}
#content_left {
padding-top: 85px;
width: 100% !important;
display: flex;
flex-direction: column;
align-items: center;
margin-left: unset !important;
padding-left: unset !important;
}
#form.has-soutu .quickdelete {
right: 10px !important;
}
.fm.has-soutu {
display: flex;
flex-direction: row;
min-width: 650px;
}
.bdsug.bdsug-new {
width: 528px !important;
}
/* Navbar tweaks */
#wrapper #head {
min-width: unset !important;
}
.s_form_wrapper {
width: 100%;
justify-content: center;
}
#form .s_ipt_wr {
width: 100% !important;
margin: 0;
padding: 0;
background: transparent;
box-shadow: none;
}
#wrapper #kw {
outline-width: 0px;
outline-style: solid;
color: rgba(107, 114, 128, 1);
transition: all 0.2s ease-in-out;
box-shadow: 0 0px 0px 0px rgb(182 182 182 / 20%),
0 0px 0px 0px rgb(182 182 182 / 20%);
padding: 5px 10px;
background-color: rgb(255 255 255 / 1);
border-color: rgb(209, 213, 219);
border-width: 1px !important;
border-radius: 7px;
border-style: solid;
margin: 0;
font-size: 15px;
line-height: 1;
width: 100% !important;
height: 100%;
}
#wrapper #kw:focus {
box-shadow: 0 10px 15px -3px rgb(182 182 182 / 20%),
0 4px 6px -4px rgb(182 182 182 / 20%);
transition: all 0.2s ease-in-out;
}
.wrapper_new.wrapper_s #form .bdsug-new,
.wrapper_new #form .bdsug-new {
width: fit-content !important;
border: 2px solid #e6e6e6 !important;
border-radius: 7px;
background: rgba(250, 250, 252);
top: 50px;
left: 50%;
transform: translateX(-50%);
padding: 0;
}
.wrapper_new #form .bdsug-new ul {
border: none !important;
}
.wrapper_s #u {
height: 100% !important;
margin: 0 !important;
display: flex;
gap: 20px;
align-items: center;
& > #myuser {
margin: 0 !important;
}
}
#u #myuser {
margin: 0 !important;
}
.wrapper_new #u {
margin: 0 !important;
padding: 10px 16px 0 0;
height: 70px !important;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
gap: 20px;
& #s-top-loginbtn,
& #user {
padding: 0 !important;
background: transparent;
margin: 0 20px !important;
}
}
@media screen and (min-width: 1225px) {
.wrapper_new #u {
flex-direction: row !important;
}
}
.c-span12 {
width: 100%;
}
.c-border {
box-shadow: none !important;
}
div[tpl="dict3"] {
padding: 10px 20px !important;
}
body {
min-width: unset !important;
& #head {
background: rgba(248, 248, 248, 0.4) !important;
border-bottom: none !important;
backdrop-filter: blur(10px) !important;
}
}
div[tpl="ai_index"] {
padding: 10px !important;
}
.wd-ai-index-pc {
width: 100% !important;
margin: 0px !important;
}
/* #wrapper #content_left .op-soft-title a,
#wrapper #content_left .result a,
#wrapper #content_left .result-op a,
#wrapper #content_left > .c-container a, */
#container.sam_newgrid .c-container .t a,
#container.sam_newgrid .c-container .c-title a {
color: #3979d3 !important;
}
/* Append hints after Baidu-related results */
/* Title alignment tweaks */
div[tpl] h3 {
display: flex;
align-items: center;
}
div[tpl] h3 > a {
margin: 0px;
}
/* Music-result styling tweaks */
#container.sam_newgrid td:nth-child(1),
#container.sam_newgrid th:nth-child(1) {
width: unset !important;
}
/* Hint section */
div[tpl="sg_kg_entity_san"] h3::after {
font-size: 12px;
color: #24bb5b;
border: 1px solid #24bb5b;
content: "Baike";
margin: 0 5px;
border-radius: 5px;
padding: 1px 6px;
font-weight: normal;
height: 18px;
display: flex;
align-items: center;
}
div[tpl*="fy_"] h3::after {
font-size: 12px;
color: #cb3f3f;
border: 1px solid #cb3f3f;
content: "Translate";
margin: 0 5px;
border-radius: 5px;
padding: 1px 6px;
font-weight: normal;
height: 18px;
display: flex;
align-items: center;
}
#b_header {
border: none !important;
background-color: transparent !important;
}
#b_content #b_results > li:not(#mfa_root) {
border: 2px solid rgba(0, 0, 0, 0.1) !important;
box-shadow: none !important;
border-radius: 6px !important;
transition: border 0.15s ease-in-out;
}
#b_content #b_results > li:not(#mfa_root):hover {
border: 2px solid rgb(0 186 145 / 60%) !important;
box-shadow: none !important;
border-radius: 6px !important;
transition: border 0.15s ease-in-out;
}
#container.sam_newgrid td:nth-child(1),
#container.sam_newgrid th:nth-child(1) {
width: 0;
}
/* Plugin style-input box tweaks */
#sp-ac-userstyleTEXT {
min-width: 100%;
min-height: 300px;
margin-left: unset !important;
}
*[ac-needhide] .blockShow:hover {
border: none;
}
div :has(> .blockShow) {
padding: 0.1rem 0.2rem !important;
&::after {
position: absolute;
right: 0.2rem;
content: "User-blocked domain – click title to show result";
color: #a9a9a9;
}
}
.nors {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, 50%);
}
#wrapper #page {
width: 100% !important;
display: flex;
align-items: center;
justify-content: space-evenly;
}
div[class*="header_"] {
position: relative;
display: unset !important;
}
a.c-text {
position: absolute !important;
right: 20px !important;
margin: 0 !important;
top: 5px !important;
border-radius: 5px !important;
padding: 1px 6px !important;
color: #3476d2 !important;
background: #fff !important;
transition: all 0.25s ease-in-out;
&:hover {
color: #3476d2 !important;
}
}
span.c-text {
margin: 0 !important;
border-radius: 5px !important;
padding: 1px 6px !important;
color: #3476d2 !important;
background: #fff !important;
transition: all 0.25s ease-in-out;
&:hover {
color: #3476d2 !important;
}
}
This blacklist approach may miss a few promotions; just find the element’s tpl attribute and append it.
For a stricter whitelist instead, use the snippet below and add allowed items the same way.
div[tpl] {
display: none;
}
/* whitelist */
div[tpl="se_com_default"], /* normal result */
div[tpl="wenda_abstract_pc"], /* Baidu Knows box */
div[tpl="bk_polysemy"], /* Baike box */
div[tpl="img_normal"] /* Baidu Images box */
{
display: block!important;
}
Before-and-after comparisons:

Query: Steam

Query: cold symptoms
With promotions hidden, the search page feels refreshingly clean—no more omnipresent ads.